SDKs and protocols
GLM-5.2
Connect to GLM-5.2 through the OpenAI Chat Completions compatible API.
GLM-5.2 uses HopBase's OpenAI Chat Completions compatible protocol. Use https://api.hop-base.com/v1 and set the model to glm-5.2.
Client fields
| Field | Value |
|---|---|
| API address / Base URL | https://api.hop-base.com/v1 |
| API Key | sk-your-key |
| Model | glm-5.2 |
| API format | OpenAI Chat Completions (routing required) |
In Claude Code, CC Switch, and other clients that support routing, GLM-5.2 does not use the Anthropic protocol. In advanced settings, select OpenAI Chat Completions (routing required).
Claude Code / CC Switch routing
Provider Name: HopBase GLM
Base URL: https://api.hop-base.com/v1
API Key: sk-your-key
Model: glm-5.2
API Format: OpenAI Chat Completions (routing required)Codex CLI
# ~/.codex/config.toml
model_provider = "hopbase-glm"
model = "glm-5.2"
[model_providers.hopbase-glm]
name = "HopBase GLM"
base_url = "https://api.hop-base.com/v1"
wire_api = "chat"export OPENAI_API_KEY=sk-your-key
codexOpenAI SDK / Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.hop-base.com/v1",
api_key="sk-your-key",
)
resp = client.chat.completions.create(
model="glm-5.2",
messages=[{"role": "user", "content": "Explain where GLM-5.2 works best"}],
)
print(resp.choices[0].message.content)curl
curl https://api.hop-base.com/v1/chat/completions \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.2",
"messages": [{"role": "user", "content": "Hello, introduce yourself"}]
}'