Skip to content
Connect a clientMigrating from OpenAI

Migrating from OpenAI

Change the URL, key, and model while checking API compatibility.

Set up with your own AI
Model protocol

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.

diff
  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.

Kimi, Composer and Grok

For another family, set its exact model and check the fields supported by the selected API. The address and key stay shared.

FamilyWhat goes in modelEndpoint
Claudeclaude-sonnet-5-5, claude-opus-5, claude-haiku-5-5/v1/chat/completions, /v1/messages, /v1/responses
Kimik3, k3-256k, kimi-for-coding, kimi-for-coding-highspeed/v1/chat/completions, /v1/messages, /v1/responses
Composercomposer-2.5, composer-2.5-fast/v1/chat/completions, /v1/messages, /v1/responses
Grokcursor-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

Move an OpenAI client to GLM

For Chat Completions or Responses, change the Base URL and model ID. Keep other fields only when the matching GLM endpoint page documents them.

FieldNew value
Base URLhttps://api.guardrelay.ai/glm/v1
API keyGUARD_API_KEY (gd-…)
Modelglm-5.3 or glm-5.3-flash
Output budgetmax_tokens: 4096 or max_output_tokens: 4096
javascript
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: false when continuation through previous_response_id is not needed.
  • background: true is 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.

Sections

On this page