Skip to content
Connect a clientVS Code

VS Code

Connect the Codex and Claude Code extensions to Guard in VS Code.

Set up with your own AI
Model protocol

Claude, Kimi, Composer and Grok

You do not need to put the key in a repository or .claude/settings.local.json. The current extension supports machine-scoped claudeCode.environmentVariables and claudeCode.disableLoginPrompt; the configuration stays on this computer and applies to opened projects.

1. Open User Settings JSON

  1. Open the Command Palette with Ctrl/Cmd + Shift + P.
  2. Choose Preferences: Open User Settings (JSON).
  3. Make sure you are editing User/Machine settings, not the project's .vscode/settings.json.

2. Add Guard

json
{
  "claudeCode.disableLoginPrompt": true,
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://api.guardrelay.ai" },
    { "name": "ANTHROPIC_AUTH_TOKEN", "value": "gd-your-key-from-the-bot" }
  ]
}

3. Open the project and trust it

  1. File → Open Folder → choose the project.
  2. Click Trust in the bottom-left (or Trust the authors in the dialog) — otherwise, in Restricted Mode, the Claude Code extension won't start and the panel won't appear.
  3. Open the Claude Code panel → New session → send a message.

System prompt (output style)

To set the model's behavior and role, create an output style in the same folder.

  1. Create .claude/output-styles/my-style.md.
  2. A name block on top, then the system prompt itself:
markdown
---
name: my-style
description: My system prompt
---
You are the Guard assistant. Answer concisely.
Always add tests to new code.

Activate it in one of two ways:

  1. in the panel via the /output-style command → pick my-style, or
  2. add only the non-secret "outputStyle": "my-style" to the project's .claude/settings.local.json — then the style turns on automatically when the folder opens:
json
{
  "outputStyle": "my-style"
}

Kimi, Composer and Grok in the panel

The panel is the same Claude Code extension, so the families are the same too: Kimi, Composer and Grok all work on /v1/messages, tools included. The panel takes its model from ANTHROPIC_MODEL, as it has no command-line flag. Full breakdown on the Claude Code page.

For those families inside the same VS Code, use Cline or Roo Code with an OpenAI-compatible provider. In Cline, kimi-for-coding and kimi-for-coding-highspeed may return 403 kimi_agent_not_allowed: use a supported client such as Roo Code or Kilo Code. Do not remove or impersonate the agent name in the system prompt to bypass this restriction.

Kimi in the Claude Code panel

The panel is the same Claude Code extension, so the settings are the same: the Guard address and the key in machine-scoped claudeCode.environmentVariables. The model goes in the same place, as ANTHROPIC_MODEL, because the panel has no command-line flag.

json
{
  "claudeCode.disableLoginPrompt": true,
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://api.guardrelay.ai" },
    { "name": "ANTHROPIC_AUTH_TOKEN", "value": "gd-your-key-from-bot" },
    { "name": "ANTHROPIC_MODEL", "value": "k3" }
  ]
}

If an OpenAI-compatible provider suits you better, Cline and Roo Code run in the same editor. Their fields are these: In Cline, kimi-for-coding and kimi-for-coding-highspeed may return 403 kimi_agent_not_allowed: use a supported client such as Roo Code or Kilo Code. Do not remove or impersonate the agent name in the system prompt to bypass this restriction.

Field in the agent settingsValue
API ProviderOpenAI-compatible
Base URLhttps://api.guardrelay.ai/v1
API Keygd-… from the bot
Modelk3, k3-256k, kimi-for-coding or kimi-for-coding-highspeed

Your own code in the same editor uses the same address. The key can be checked right in the built-in terminal:

bash
curl -X POST https://api.guardrelay.ai/v1/chat/completions \
  -H "Authorization: Bearer gd-your-key-from-the-bot" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "k3",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 128
  }'

Point the panel at Grok

The panel is the same Claude Code extension, so the settings are the same: the Guard address and the key in machine-scoped claudeCode.environmentVariables. The model goes in the same place, as ANTHROPIC_MODEL, because the panel has no command-line flag.

json
{
  "claudeCode.disableLoginPrompt": true,
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://api.guardrelay.ai" },
    { "name": "ANTHROPIC_AUTH_TOKEN", "value": "gd-your-key-from-the-bot" },
    { "name": "CLAUDE_CODE_MAX_CONTEXT_TOKENS", "value": "256000" },
    { "name": "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS", "value": "1" },
    { "name": "ANTHROPIC_MODEL", "value": "cursor-grok-4.7-high" }
  ]
}

Point the panel at Composer

The panel is the same Claude Code extension, so the settings are the same: the Guard address and the key in machine-scoped claudeCode.environmentVariables. The model goes in the same place, as ANTHROPIC_MODEL, because the panel has no command-line flag.

json
{
  "claudeCode.disableLoginPrompt": true,
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://api.guardrelay.ai" },
    { "name": "ANTHROPIC_AUTH_TOKEN", "value": "gd-your-key-from-the-bot" },
    { "name": "ANTHROPIC_MODEL", "value": "composer-2.5" }
  ]
}

The rest is as usual: File → Open Folder, the Trust button in the bottom-left, then the Claude Code panel → New session. In Restricted Mode the extension does not start and the panel does not appear.

GLM 5.3 in VS Code

Install the editor and extension

  1. Install Visual Studio Code and open it.
  2. Open Extensions (Ctrl/Cmd + Shift + X), find Claude Code by Anthropic, and select Install.
  3. Use File → Open Folder to open a test folder. Check its path before granting trust.

Get a Guard key

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.

Add machine settings

  1. Open Command Palette → Preferences: Open User Settings (JSON). Do not use Workspace settings or .vscode/settings.json.
  2. Merge the fields below into the existing JSON. They set the endpoint and model without storing the key.
  3. Quit VS Code completely, set ANTHROPIC_API_KEY in a terminal, and start code . from that terminal.
json
{
  "claudeCode.disableLoginPrompt": true,
  "claudeCode.useTerminal": false,
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://api.guardrelay.ai/glm" },
    { "name": "ANTHROPIC_MODEL", "value": "glm-5.3" }
  ]
}

macOS / Linux: enter the key at the hidden prompt. The variable applies only to this terminal and the client started from it.

sh
{
unset ANTHROPIC_API_KEY
until [ -n "${ANTHROPIC_API_KEY-}" ]; do printf "Guard API key: "; read -r -s ANTHROPIC_API_KEY || break; printf "\n"; done
export ANTHROPIC_API_KEY

code .
}

Windows PowerShell: run these commands in the same window that starts the client. Set the key again after opening a new PowerShell window.

powershell
$guardKey = Read-Host "Guard API key" -AsSecureString
$env:ANTHROPIC_API_KEY = [System.Net.NetworkCredential]::new("", $guardKey).Password

code .

Quick check and continuation

  1. Open the Claude Code panel → New session.
  2. Send: Read README.md and reply with exactly GUARD_GLM_OK. Change nothing.
  3. In the same session, ask for the line without reopening the file. For Flash, change ANTHROPIC_MODEL to glm-5.3-flash and restart the window.

Models and confirmed capabilities

Model IDWhen to use it
glm-5.3Default model; text and coding tasks.
glm-5.3-flashFast model; at API level it accepts PNG and PDF through all three protocols, and MP4 through Chat Completions only.
  • Text, client-side file and terminal tools, and continuation in the same panel 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 Anthropic Messages. 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-flash for images.

If the connection fails

SymptomWhat to check
401 invalid_api_keyThe client received the complete active gd-… key; the variable is set in the same process that starts the client.
404 model_not_foundThe model ID is exactly glm-5.3 or glm-5.3-flash; old GLM IDs, aliases, Turbo, and FlashX are unsupported.
404 or incorrect pathBase URL is https://api.guardrelay.ai/glm. The client appends /v1/messages; do not add it twice.
400 invalid_requestThe documented API format is selected; reasoning, temperature, MCP, or other unconfirmed fields were not copied from an older profile.
402 insufficient_balanceCheck available balance and unfinished reservations in your Guard account.
The extension asks for login or cannot see the keyClose every VS Code window and start code . from the terminal where ANTHROPIC_API_KEY is set; check claudeCode.disableLoginPrompt.

Gemini in VS Code

Install the editor and extension

  1. Install Visual Studio Code and open it.
  2. Open Extensions (Ctrl/Cmd + Shift + X), find Claude Code by Anthropic, and select Install.
  3. Use File → Open Folder to open a test folder. Check its path before granting trust.

Get a Guard key

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.

Add machine settings

  1. Open Command Palette → Preferences: Open User Settings (JSON). Do not use Workspace settings or .vscode/settings.json.
  2. Merge the fields below into the existing JSON. They set the endpoint and model without storing the key.
  3. Quit VS Code completely, set ANTHROPIC_AUTH_TOKEN in a terminal, and start code . from that terminal. With ANTHROPIC_API_KEY, the extension may show a sign-in screen in a clean profile.
json
{
  "claudeCode.disableLoginPrompt": true,
  "claudeCode.useTerminal": false,
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://api.guardrelay.ai" },
    { "name": "ANTHROPIC_MODEL", "value": "gemini-4-argon" }
  ]
}

macOS / Linux: enter the key at the hidden prompt. The variable applies only to this terminal and the client started from it.

sh
{
unset ANTHROPIC_AUTH_TOKEN
until [ -n "${ANTHROPIC_AUTH_TOKEN-}" ]; do printf "Guard API key: "; read -r -s ANTHROPIC_AUTH_TOKEN || break; printf "\n"; done
export ANTHROPIC_AUTH_TOKEN
code .
}

Windows PowerShell: run these commands in the same window that starts the client. Set the key again after opening a new PowerShell window.

powershell
$guardKey = Read-Host "Guard API key" -AsSecureString
$env:ANTHROPIC_AUTH_TOKEN = [System.Net.NetworkCredential]::new("", $guardKey).Password
code .

Quick check and continuation

  1. Open the Claude Code panel → New session.
  2. Send: Read README.md and reply with exactly GUARD_GEMINI_OK. Change nothing.
  3. In the same session, ask for the line without reopening the file. For another model, change ANTHROPIC_MODEL, for example to gemini-3.8-flash, and restart the window.

Gemini models and capabilities

Model IDInput and window
gemini-4-argonText, images, PDF; 1,048,576-token window, shared by input and answer.
gemini-3.8-flashText, images, PDF; 1,048,576-token window for input.
  • The extension itself executes file and terminal tools; it sends the session history to Gemini with every request.
  • 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 Anthropic Messages. 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.

If the connection fails

SymptomWhat to check
401 invalid_api_keyThe client received the complete active gd-… key; the variable is set in the same process that starts the client.
404 model_not_foundThe model ID is an exact ID from the table above or the short name gemini; other spellings are unsupported.
404 or incorrect pathBase URL is https://api.guardrelay.ai. The client appends /v1/messages; do not add it twice.
400 invalid_requestThe documented API format is selected; extra settings from an older profile were not copied: reasoning, temperature, MCP, and others.
402 insufficient_creditCheck available balance and unfinished reservations in your Guard account.
The extension asks for login or cannot see the keyClose every VS Code window and start code . from the terminal where ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY) is set; check claudeCode.disableLoginPrompt.

Muse in VS Code

Install the editor and extension

  1. Install Visual Studio Code and open it.
  2. Open Extensions (Ctrl/Cmd + Shift + X), find Claude Code by Anthropic, and select Install.
  3. Use File → Open Folder to open a test folder. Check its path before granting trust.

Get a Guard key

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.

Add machine settings

  1. Open Command Palette → Preferences: Open User Settings (JSON). Do not use Workspace settings or .vscode/settings.json.
  2. Merge the fields below into the existing JSON. They set the endpoint and model without storing the key.
  3. Quit VS Code completely, set ANTHROPIC_AUTH_TOKEN in a terminal, and start code . from that terminal. With ANTHROPIC_API_KEY, the extension may show a sign-in screen in a clean profile.
json
{
  "claudeCode.disableLoginPrompt": true,
  "claudeCode.useTerminal": false,
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://api.guardrelay.ai" },
    { "name": "ANTHROPIC_MODEL", "value": "muse-wonder-1.0" }
  ]
}

macOS / Linux: enter the key at the hidden prompt. The variable applies only to this terminal and the client started from it.

sh
{
unset ANTHROPIC_AUTH_TOKEN
until [ -n "${ANTHROPIC_AUTH_TOKEN-}" ]; do printf "Guard API key: "; read -r -s ANTHROPIC_AUTH_TOKEN || break; printf "\n"; done
export ANTHROPIC_AUTH_TOKEN
code .
}

Windows PowerShell: run these commands in the same window that starts the client. Set the key again after opening a new PowerShell window.

powershell
$guardKey = Read-Host "Guard API key" -AsSecureString
$env:ANTHROPIC_AUTH_TOKEN = [System.Net.NetworkCredential]::new("", $guardKey).Password
code .

Quick check and continuation

  1. Open the Claude Code panel → New session.
  2. Send: Read README.md and reply with exactly GUARD_MUSE_OK. Change nothing.
  3. In the same session, ask for the line without reopening the file. For another model, change ANTHROPIC_MODEL, for example to muse-spark-1.3, and restart the window.

Muse models and capabilities

Model IDInput and window
muse-wonder-1.0Text, images, PDF; 1,048,576-token window.
muse-spark-1.3Text, images, PDF; 1,048,576-token window.
muse-spark-1.2Text, images, PDF; 1,048,576-token window.
  • The extension itself executes file and terminal tools; it sends the session history to Muse with every request.
  • 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 Anthropic Messages. 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.

If the connection fails

SymptomWhat to check
401 invalid_api_keyThe client received the complete active gd-… key; the variable is set in the same process that starts the client.
404 model_not_foundThe model ID is an exact ID from the table above or the short name muse; other spellings are unsupported.
404 or incorrect pathBase URL is https://api.guardrelay.ai. The client appends /v1/messages; do not add it twice.
400 invalid_requestThe documented API format is selected; extra settings from an older profile were not copied: reasoning, temperature, MCP, and others.
402 insufficient_creditCheck available balance and unfinished reservations in your Guard account.
The extension asks for login or cannot see the keyClose every VS Code window and start code . from the terminal where ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY) is set; check claudeCode.disableLoginPrompt.

Codex in VS Code: setup from scratch

Before you start

Get a gd-… key from the Guard bot: open the bot, obtain access and copy your key. Usage is charged to your Guard balance, shown in your Guard account. You will enter the full key at the hidden prompt in a later step.

The Codex family includes gpt-6-astra, gpt-6.1-sol, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna. The primary example selects Astra; you may use any of the seven exact IDs. The table shows values supported by Guard. For Astra, GPT-6.1 Sol, GPT-6 Sol, GPT-5.6 Sol, and GPT-5.6 Terra the Codex client additionally offers the ultra level. It works through Guard: the client itself turns it into a supported level (xhigh or max, depending on the model) and may hand parts of the task to sub-agents, so it uses more tokens. A direct API request with ultra is rejected. GPT-6.1 Sol defaults to low; none and minimal are unsupported. The API supports none for GPT-6 Sol and GPT-6 Luna, although the native dropdown does not show it.

Model IDGuard-supported reasoning effort
gpt-6-astralow, medium, high, xhigh, max
gpt-6.1-sollow, medium, high, xhigh, max
gpt-6-solnone, low, medium, high, xhigh, max
gpt-6-lunanone, low, medium, high, xhigh, max
gpt-5.6-sollow, medium, high, xhigh, max
gpt-5.6-terralow, medium, high, xhigh, max
gpt-5.6-lunalow, medium, high, xhigh, max

Install the editor and extension

  1. Install Visual Studio Code and open it.
  2. Open Extensions using the left sidebar or Ctrl+Shift+X (Cmd+Shift+X on macOS). Find Codex by OpenAI. The official link is on the Codex extension page. Click Install.
  3. Choose File → Open Folder and select your project. If a trust prompt appears, check the folder path.
  4. Click the Codex icon. If it is missing, open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and run Codex: Open Codex Sidebar.

Open Codex settings

In the Codex panel, choose the gear in the upper right → Codex Settings → Open config.toml. This opens the user file also used by Codex CLI. If that action is unavailable, the Codex CLI guide includes the file path and creation commands.

Add the Guard provider

Add the settings below. Put the first four lines at the top of the file, before the first [section] heading. If model, model_provider, model_reasoning_effort or model_context_window already exist, update their existing lines. Add [model_providers.guard-codex] once, or update its fields if it exists. Save the file.

toml
model = "gpt-6-astra"
model_provider = "guard-codex"
model_reasoning_effort = "medium"
model_context_window = 872000

[model_providers.guard-codex]
name = "GUARD API · Codex"
base_url = "https://api.guardrelay.ai/codex/v1"
env_key = "GUARD_API_KEY"
wire_api = "responses"
Model IDmodel_context_window
gpt-6-astra872000
gpt-6.1-sol872000
gpt-6-sol872000
gpt-6-luna872000
gpt-5.6-sol872000
gpt-5.6-terra872000
gpt-5.6-luna872000

model_context_window sets the client history budget. The table uses the declared maximum from the latest saved Codex catalog dated September 13, 2026; it is not a guarantee of the API input hard limit. History compaction may start earlier; this setup does not set a per-response output cap.

SettingMeaning
modelExact model ID; GPT-5.6 Sol here.
model_providerProvider section name below: guard-codex.
model_reasoning_effortReasoning effort. This example uses medium; choose only a supported value from the table above.
base_urlGuard address for this family. Do not append /responses manually.
env_keyName of the environment variable containing your key, not the key itself.
wire_apiResponses

If you previously used model_catalog_json with a Claude model catalog, remove that setting when switching to the Codex family. The Claude catalog does not contain GPT models. Do not infer a response limit from model_context_window: if the client sends max_output_tokens, Guard accepts and preserves it, but managed Codex does not guarantee hard truncation; billing follows actual tokens and the key's money rules.

Provide your key to the application

macOS / Linux: run these commands, paste your key at the Guard API key prompt, and press Enter. Input is hidden and is not stored as part of a shell command in history. The variable applies to that terminal and programs launched from it.

bash
unset GUARD_API_KEY; until [ -n "${GUARD_API_KEY-}" ]; do printf "Guard API key: "; read -r -s GUARD_API_KEY || break; printf "\n"; done; export GUARD_API_KEY

Windows / PowerShell: run these commands in the window you will use to start the client; paste the key into the hidden prompt and press Enter. Set the variable again when opening a new terminal.

powershell
$guardKey = Read-Host "Guard API key" -AsSecureString
$env:GUARD_API_KEY = [System.Net.NetworkCredential]::new("", $guardKey).Password

Launch the editor with the key

Fully quit VS Code: Cmd+Q on macOS, or File → Exit on Windows. In the terminal where GUARD_API_KEY is set, run code followed by your project path. Opening a window in an already running VS Code process may retain the old environment without your key.

bash
code .

The dot means your terminal’s current folder. If code is not found on macOS, run Shell Command: Install code command in PATH from the VS Code Command Palette. On Windows, check the installer’s Add to PATH option and reopen PowerShell, then set your key variable again.

Send your first request

  1. Open the Codex panel and start a new task. Check gpt-6-astra in the panel and model_provider = "guard-codex" in config.toml.
  2. Ask: “Read the project file list and briefly explain its structure.” Wait for the answer and assess any access or command approval by the action shown.
  3. In the same conversation, ask for more detail about one file. For a persistent model change, update model and a supported reasoning effort in config.toml, then start a new task.

For Codex models, use only the Claude Code extension native addon profile. Store only the settings below in User/Machine settings. Before launching VS Code, provide ANTHROPIC_API_KEY with the same hidden runtime method described above for the key, set the process environment to ANTHROPIC_BASE_URL=https://api.guardrelay.ai/codex, ANTHROPIC_MODEL=gpt-6-astra, DISABLE_PROMPT_CACHING=1, and CLAUDE_CODE_DISABLE_THINKING=1, then launch VS Code from that environment. Do not store the key, base, or model in settings or command history; ANTHROPIC_AUTH_TOKEN is not used here. SIMPLE/SAFE exposes Bash, Edit, and Read; it disables custom skills, plugins, hooks, MCP, custom agents, memory, LSP, and automatic CLAUDE.md loading. The context meter may show NaN%. Ordinary native and terminal modes are not claimed for Codex.

json
{
  "claudeCode.disableLoginPrompt": true,
  "claudeCode.useTerminal": false,
  "claudeCode.environmentVariables": [
    { "name": "CLAUDE_CODE_SIMPLE", "value": "1" },
    { "name": "CLAUDE_CODE_SAFE_MODE", "value": "1" }
  ]
}

If connection fails

What you seeWhat to check
GUARD_API_KEY / missing environment variableThe process did not receive the key. Close the client and launch it from the terminal where you set the variable.
401 / invalid_api_keyThe variable contains your full actual gd-key rather than a placeholder; the key is active in your Guard account.
model_not_foundThe ID exactly matches the model list. Remove the old Claude catalog and check the /codex/v1 address.
TOML / duplicate keyNo duplicated settings or sections. Top-level options appear before [model_providers.guard-codex].
insufficient_balanceYour Guard account has available balance.

If the error repeats, send Guard support the client name and version, model, error text and request time. Do not send your key or entire configuration file.

Sections

On this page