In the OpenAI SDK, replace base_url and the key, then set an exact Guard model. Check other fields against the selected family and API contract: compatibility does not imply every OpenAI feature is supported.
from openai import OpenAI
client = OpenAI(
- api_key=OPENAI_KEY,
+ api_key=GUARD_KEY,
+ base_url="https://api.guardrelay.ai/v1",
)Set a Claude model such as claude-sonnet-5-5 instead of an OpenAI model, and check parameters against Chat Completions.
For another family, set its exact model and check the fields supported by the selected API. The address and key stay shared.
| Family | What goes in model | Endpoint |
|---|---|---|
| Claude | claude-sonnet-5-5, claude-opus-5, claude-haiku-5-5 | /v1/chat/completions, /v1/messages, /v1/responses |
| Kimi | k3, k3-256k, kimi-for-coding, kimi-for-coding-highspeed | /v1/chat/completions, /v1/messages, /v1/responses |
| Composer | composer-2.5, composer-2.5-fast | /v1/chat/completions, /v1/messages, /v1/responses |
| Grok | cursor-grok-4.7-high is the recommended default; the other seven Grok 4.7 ids and eight Grok 4.6 ids are in the catalog | /v1/chat/completions, /v1/messages, /v1/responses |
For Chat Completions or Responses, change the Base URL and model ID. Keep other fields only when the matching GLM endpoint page documents them.
| Field | New value |
|---|---|
| Base URL | https://api.guardrelay.ai/glm/v1 |
| API key | GUARD_API_KEY (gd-…) |
| Model | glm-5.3 or glm-5.3-flash |
| Output budget | max_tokens: 4096 or max_output_tokens: 4096 |
const client = new OpenAI({
apiKey: process.env.GUARD_API_KEY,
baseURL: "https://api.guardrelay.ai/glm/v1",
maxRetries: 0,
});
const response = await client.responses.create({
model: "glm-5.3",
input: "Reply with OK",
max_output_tokens: 4096,
store: false,
});- Responses is stored by default; send
store: falsewhen continuation throughprevious_response_idis not needed. background: trueis unsupported.- Built-in search uses the exact GLM objects on Web search, not an arbitrary schema from another API.
- Files/Conversations/Assistants/Batch and WebSocket are outside the published GLM contract.
The response model field preserves the Z.AI value; billing and Usage API remain attached to the exact public ID requested by the client.