ZCode is the desktop agent app from Z.ai for macOS, Windows and Linux (download page). A third-party provider is added right in the settings: name, address, key and a model list. Guard connects as one provider for every family at once.
- Open Settings (the button in the lower-left corner), then Model settings, Add provider, Custom endpoint.
- Name:
Guard AI. - Base URL:
https://api.guardrelay.ai(without/v1: ZCode appends the/v1/messagespath itself). - API key: your
gd-…key from the bot. - API format:
Anthropic messages (/v1/messages). - Add model: enter the Model ID from the list below and the context window; under Advanced set Max output tokens:
128000for Claude Fable 5, Fable 5.1, Opus 5.5, Opus 5, Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 5.5, Sonnet 5, Sonnet 4.6 and Haiku 5.5;64000for Claude Opus 4.5, Sonnet 4.5 and Haiku 4.5;128000for Grok;32000for Composer; leave the field empty for Kimi. Repeat for every model you need. - Click Add provider, switch the provider on and pick a model in the chat.
Type the model id exactly as listed: ZCode sends it to the server unchanged. The context window is the budget the client uses for the chat history. Max output tokens is the limit for one response. Guard serves it up to the model limit; if the key balance cannot cover the reserve for such a response with room for 8 more regular requests, Claude and Grok answer within 32,000. Kimi receives the value as is, and with an empty field ZCode itself sends 32,000. ZCode subtracts this limit from the context window, so a larger limit compacts the history earlier.
| Model ID | Context window |
|---|---|
claude-sonnet-5-5 | 1M |
claude-sonnet-5 | 1M |
claude-opus-5-5 | 1M |
claude-opus-5 | 1M |
claude-fable-5-1 | 1M |
claude-fable-5 | 1M |
claude-opus-4-8 | 1M |
claude-opus-4-7 | 1M |
claude-opus-4-6 | 1M |
claude-opus-4-5 | 200K |
claude-sonnet-4-6 | 1M |
claude-sonnet-4-5 | 200K |
claude-haiku-5-5 | 1M |
claude-haiku-4-5 | 200K |
| Model ID | Context window |
|---|---|
k3 | 1M |
k3-256k | 256K |
kimi-for-coding | 1M |
kimi-for-coding-highspeed | 256K |
| Model ID | Context window |
|---|---|
cursor-grok-4.7-low, cursor-grok-4.7-medium, cursor-grok-4.7-high, cursor-grok-4.7-xhigh | 256K |
cursor-grok-4.7-low-fast, cursor-grok-4.7-medium-fast, cursor-grok-4.7-high-fast, cursor-grok-4.7-xhigh-fast | 256K · Fast |
cursor-grok-4.6-low, cursor-grok-4.6-medium, cursor-grok-4.6-high, cursor-grok-4.6-xhigh | 500K |
cursor-grok-4.6-low-fast, cursor-grok-4.6-medium-fast, cursor-grok-4.6-high-fast, cursor-grok-4.6-xhigh-fast | 500K |
| Model ID | Context window |
|---|---|
composer-2.5 | 200K |
composer-2.5-fast | 200K |
Context window takes a number: Claude 1M is 1000000, Kimi K3 and K2.8 Preview (kimi-for-coding) use 1048576, K3-256K and K2.7 Code HighSpeed use 262144, Grok 4.7 uses 256000, while Grok 4.6 uses 500000, and Composer or 200K Claude models use 200000.
Context mode for Composer
For composer-2.5 and composer-2.5-fast, you can enable a separate context counter mode. ZCode receives an estimate of the current history and visible response: accumulated usage across the whole run is no longer used as the size of a single context window.
- In Settings → Model settings, open your existing Guard provider using the Anthropic messages format.
- Change only Base URL to
https://api.guardrelay.ai/zcodeand save. Keep your existing key and selected model; ZCode appends/v1/messagesitself. - To restore regular token usage in API responses, change Base URL back to
https://api.guardrelay.ai.
Charges and prices stay the same: your Guard account records actual usage. The ZCode context counter in this mode is an estimate and should not be used to calculate request cost.
For integrations: requests go to POST /zcode/v1/messages. usage_source is context_estimate, and usage contains the estimate. In a completed response, billing_usage contains actual aggregate usage for the run, matching usage on the regular endpoint. While waiting for a client tool result or before confirmed completion, billing_usage is null.
Prices and details for every model are on the Models page. For Grok the reasoning level is chosen by the model name (low, medium, high, xhigh); Composer has no reasoning: the ZCode reasoning switch does not affect these models.
The reasoning mode ZCode enables by default is adjusted by Guard to what each model accepts: Sonnet 5.5, Opus 5.5 and Fable 5.1 always reason adaptively, enabled reasoning on Haiku 5.5 becomes adaptive, and the effort level is not applied on Haiku 4.5 and Sonnet 4.5. Kimi takes the ZCode reasoning parameters as is.
To receive an image created by Grok or Composer, ask the model to save it in the working folder. Supported images are delivered at the end of the reply as a download link valid for 24 hours, accessible without a key. Automatically created assets without that save step are not delivered. This delivers images, not arbitrary files. There is no separate file fee; request tokens are billed.
Install ZCode from the official page. Open a separate test folder without secrets, then go to Settings → Model settings.
Get a universal gd-… key from the direct API link in @guardapi and choose an API package. Do not put the key in a project, repository, task prompt, or screenshot. Balance and usage are available in your Guard account.
- Select Add provider → Create custom provider. In ZCode 3.14.3 the new entry may be named New provider.
- Set Base URL to
https://api.guardrelay.ai/glm/v1, choose Responses (/responses) under API format, and enter thegd-…key under API key. - Select Add model, keep Smart configuration enabled, and enter Model ID
glm-5.3. - Leave Context window and Max output tokens blank: the verified configuration did not set an assumed numeric limit. Save the model and provider.
- Repeat Add model for
glm-5.3-flashif needed.
| ZCode field | Value |
|---|---|
| Provider | New provider |
| Base URL | https://api.guardrelay.ai/glm/v1 |
| API format | Responses (/responses) |
| API key | gd-… |
| Model ID | glm-5.3 |
| Smart configuration | enabled |
| Context window / Max output tokens | leave blank |
| Final request | POST https://api.guardrelay.ai/glm/v1/responses |
- Select
glm-5.3in a new conversation and open a separate test folder containingREADME.md. - Send:
Read README.md and reply with exactly GUARD_GLM_OK. Change nothing. - In the same chat, ask for the line without reopening the file. Use a new chat only for a separate task.
| Model ID | When to use it |
|---|---|
glm-5.3 | Default model; text and coding tasks. |
glm-5.3-flash | Fast model; at API level it accepts PNG and PDF through all three protocols, and MP4 through Chat Completions only. |
- Responses, local Read/Edit/Bash tools, and continuation of the same ZCode chat are confirmed.
- The client itself executes file, edit, and terminal tools. This profile does not connect Z.AI tools or MCP automatically.
- This version was checked with text tasks; its attachment button was not checked. Flash capability at API level does not prove that this particular UI can send a file.
- The profile uses OpenAI Responses. The GLM server prompt is off by default for ordinary API access; client setup does not enable it.
- Native TXT, DOCX, and XLSX are outside the confirmed GLM contract. Use PDF for documents, or PNG with
glm-5.3-flashfor images.
| Symptom | What to check |
|---|---|
401 invalid_api_key | The client received the complete active gd-… key; the variable is set in the same process that starts the client. |
404 model_not_found | The model ID is exactly glm-5.3 or glm-5.3-flash; old GLM IDs, aliases, Turbo, and FlashX are unsupported. |
404 or incorrect path | Base URL is https://api.guardrelay.ai/glm/v1. The client appends /responses; do not add it twice. |
400 invalid_request | The documented API format is selected; reasoning, temperature, MCP, or other unconfirmed fields were not copied from an older profile. |
402 insufficient_balance | Check available balance and unfinished reservations in your Guard account. |
| The Add provider UI looks different | Check version 3.14.3. Its path is Add provider → Create custom provider; do not reuse 3.9.1 steps. |
404 after saving | Responses (/responses) is selected, Base URL does not contain /responses, Smart configuration is enabled, and Model ID is exact. |
Install ZCode from the official page. Open a separate test folder without secrets, then go to Settings → Model settings.
Get a universal gd-… key from the direct API link in @guardapi and choose an API package. Do not put the key in a project, repository, task prompt, or screenshot. Balance and usage are available in your Guard account.
- Select Add provider → Create custom provider. The new entry may be named New provider.
- Set Base URL to
https://api.guardrelay.ai/v1, choose Responses (/responses) under API format, and enter thegd-…key under API key. - Select Add model, keep Smart configuration enabled, and enter Model ID
gemini-4-argon. - Leave Context window and Max output tokens blank: ZCode itself chooses the numeric limits. Save the model and provider.
- Repeat Add model for the other IDs from the table below if needed.
| ZCode field | Value |
|---|---|
| Provider | New provider |
| Base URL | https://api.guardrelay.ai/v1 |
| API format | Responses (/responses) |
| API key | gd-… |
| Model ID | gemini-4-argon |
| Smart configuration | enabled |
| Context window / Max output tokens | leave blank |
| Final request | POST https://api.guardrelay.ai/v1/responses |
- Select
gemini-4-argonin a new conversation and open a separate test folder containingREADME.md. - Send:
Read README.md and reply with exactly GUARD_GEMINI_OK. Change nothing. - In the same chat, ask for the line without reopening the file. Use a new chat only for a separate task.
| Model ID | Input and window |
|---|---|
gemini-4-argon | Text, images, PDF; 1,048,576-token window, shared by input and answer. |
gemini-3.8-flash | Text, images, PDF; 1,048,576-token window for input. |
- ZCode itself executes the local read, edit, and command tools; the conversation continues in the same chat.
- The Guard catalog takes text, images, and PDF as input and returns text. How to send a file or an image depends on the client's interface; this guide does not describe attachments.
- The profile uses OpenAI Responses. The server prompt is a separate setting of the Gemini family: it applies only when the key has the entitlement and the option is on; client setup does not enable it.
| Symptom | What to check |
|---|---|
401 invalid_api_key | The client received the complete active gd-… key; the variable is set in the same process that starts the client. |
404 model_not_found | The model ID is an exact ID from the table above or the short name gemini; other spellings are unsupported. |
404 or incorrect path | Base URL is https://api.guardrelay.ai/v1. The client appends /responses; do not add it twice. |
400 invalid_request | The documented API format is selected; extra settings from an older profile were not copied: reasoning, temperature, MCP, and others. |
402 insufficient_credit | Check available balance and unfinished reservations in your Guard account. |
| The Add provider UI looks different | The steps above follow Add provider → Create custom provider. If your ZCode version names things differently, find the same fields in it: Base URL, API format, API key, and Model ID. |
404 after saving | Responses (/responses) is selected, Base URL does not contain /responses, Smart configuration is enabled, and Model ID is exact. |
Install ZCode from the official page. Open a separate test folder without secrets, then go to Settings → Model settings.
Get a universal gd-… key from the direct API link in @guardapi and choose an API package. Do not put the key in a project, repository, task prompt, or screenshot. Balance and usage are available in your Guard account.
- Select Add provider → Create custom provider. The new entry may be named New provider.
- Set Base URL to
https://api.guardrelay.ai/v1, choose Responses (/responses) under API format, and enter thegd-…key under API key. - Select Add model, keep Smart configuration enabled, and enter Model ID
muse-wonder-1.0. - Leave Context window and Max output tokens blank: ZCode itself chooses the numeric limits. Save the model and provider.
- Repeat Add model for the other IDs from the table below if needed.
| ZCode field | Value |
|---|---|
| Provider | New provider |
| Base URL | https://api.guardrelay.ai/v1 |
| API format | Responses (/responses) |
| API key | gd-… |
| Model ID | muse-wonder-1.0 |
| Smart configuration | enabled |
| Context window / Max output tokens | leave blank |
| Final request | POST https://api.guardrelay.ai/v1/responses |
- Select
muse-wonder-1.0in a new conversation and open a separate test folder containingREADME.md. - Send:
Read README.md and reply with exactly GUARD_MUSE_OK. Change nothing. - In the same chat, ask for the line without reopening the file. Use a new chat only for a separate task.
| Model ID | Input and window |
|---|---|
muse-wonder-1.0 | Text, images, PDF; 1,048,576-token window. |
muse-spark-1.3 | Text, images, PDF; 1,048,576-token window. |
muse-spark-1.2 | Text, images, PDF; 1,048,576-token window. |
- ZCode itself executes the local read, edit, and command tools; the conversation continues in the same chat.
- The Guard catalog takes text, images, and PDF as input and returns text. How to send a file or an image depends on the client's interface; this guide does not describe attachments.
- The profile uses OpenAI Responses. The server prompt is a separate setting of the Muse family: it applies only when the key has the entitlement and the option is on; client setup does not enable it.
| Symptom | What to check |
|---|---|
401 invalid_api_key | The client received the complete active gd-… key; the variable is set in the same process that starts the client. |
404 model_not_found | The model ID is an exact ID from the table above or the short name muse; other spellings are unsupported. |
404 or incorrect path | Base URL is https://api.guardrelay.ai/v1. The client appends /responses; do not add it twice. |
400 invalid_request | The documented API format is selected; extra settings from an older profile were not copied: reasoning, temperature, MCP, and others. |
402 insufficient_credit | Check available balance and unfinished reservations in your Guard account. |
| The Add provider UI looks different | The steps above follow Add provider → Create custom provider. If your ZCode version names things differently, find the same fields in it: Base URL, API format, API key, and Model ID. |
404 after saving | Responses (/responses) is selected, Base URL does not contain /responses, Smart configuration is enabled, and Model ID is exact. |
For ZCode 3.9.1.5853, use a separate OpenAI Responses provider with exact gpt-6-astra. Get your gd-… key from the Guard bot. This guide covers Responses/Astra only; it does not confirm Chat, other models, or other ZCode versions.
For a connection check, use a plain chat without files and ask “Reply: connection established”. To check project work, create a separate guard-test folder in File Explorer or Finder, open it in your editor, and create README.md containing “This is a Guard test project”. The file-reading example below uses that folder.
- Open Settings → Model settings. If settings are closed, select the model name by the chat input and choose Manage Models.
- Select Add provider → Custom endpoint. Do not edit an existing provider for Claude, Kimi, GLM, Gemini, Muse, Composer, or Grok.
- Set Name to
GUARD API · Codex. - Paste
https://api.guardrelay.ai/codex/v1into Base URL. - Paste your
gd-…key from the bot into API key; never put the key in a project file or chat message. - Choose
Responses (/responses)under API format and save the provider.
- Open the new provider and select Add model. If this button appears before saving the provider, add the model in the same form.
- Enter the exact
gpt-6-astravalue in Model ID and choose OpenAI Responses for it. See Models for other IDs and effort levels. - If ZCode shows Thought Level, choose
Lowfor this Astra profile; do not append effort to the Model ID. - Set Context window to
272000. Under Advanced → Max output tokens, set128000: Guard preservesmax_output_tokensas advisory for managed Codex without promising hard response truncation. - Save the model and enable the provider toggle.
| Model ID | Context window for ZCode |
|---|---|
gpt-6-astra | 272000 |
gpt-6.1-sol | 872000 |
gpt-6-sol | 872000 |
gpt-6-luna | 872000 |
gpt-5.6-sol | 872000 |
gpt-5.6-terra | 872000 |
gpt-5.6-luna | 872000 |
Use 272000 for the proved Astra profile. The other rows are catalog budgets for client setup only and do not verify those models in ZCode. ZCode may compact history earlier; Context window does not set a one-response limit.
| ZCode field | Value |
|---|---|
| Base URL | https://api.guardrelay.ai/codex/v1 |
| API format | Responses (/responses) |
| Model ID | gpt-6-astra |
| Model API format | OpenAI Responses |
| Context window | 272000 |
| Max output tokens | 128000 · advisory |
| Final request | POST https://api.guardrelay.ai/codex/v1/responses |
Choose a reasoning level only if ZCode shows Thought Level for the selected model. Check the allowed values under Models; do not add an effort suffix to the Model ID or substitute another model. If there is no selector, leave the default setting.
- Choose a test workspace without keys or personal data and with a
README.md. In a new chat, keep Ask before changes, select the model name beside the input, and chooseGUARD API · Codex→gpt-6-astra. - Send:
Read README.md and explain in two sentences what this test project does. Do not change anything.If ZCode asks for permission, allow only a read of that file. - After the reply, send in the same chat:
Name one fact from README.md that supports your explanation.Start a new chat for a different task.
After checking file reading, you can request a change: “Add a Test section and one descriptive line to README.md.” Review the proposed edit and approve it if it matches your task. Command, file and tool permissions are controlled by the client; connecting Guard does not require granting unrestricted access to your whole computer.