CLAUDE CODE · TERMINAL CLI

Connect Claude Code to Antigravity Manager

Use Manager’s sync action or set Claude Code’s gateway address and API key yourself. Then check the active connection, try a small file edit, and keep the setup that works for you.

Manager 5.0.0 · Updated

Before you connect

Install Claude Code, check that claude --version runs, and have Manager’s API Proxy running with an account that can use your chosen model.

Values for a local connection. Scroll sideways on small screens.
SettingValue to use
Gateway addresshttp://127.0.0.1:8045 — replace the port with your API Proxy port.
API keyThe gateway key shown in Manager’s API Proxy settings.
ModelThe exact model ID that answered your first API request.

For persistent changes, close your running Claude Code sessions and save dated copies of ~/.claude/settings.json and ~/.claude.json, if they exist. On Windows, these paths start under your user profile. Keep the backups private because they can contain credentials.

If you use CLAUDE_CONFIG_DIR, choose manual configuration in that directory. Manager 5.0.0 sync targets the default paths above. Also check project settings and your active CC Switch profile before switching providers.

Choose Manager sync for a saved setup, or a temporary terminal connection to try the gateway first.

Connect with Manager sync

Use the Claude Code card in Manager’s agent-tools panel to save the gateway address, key and selected model to your client configuration.

  1. Open API Proxy, check the key and port, and click Start Service if the service is stopped.
  2. Open One-Click Agent Tools Configuration. On the Claude Code card, choose your working model in Select Model, then click Sync Config Now.
  3. Use View Config to check the generated address and model locally. Keep the gateway key out of screenshots and shared logs.
  4. Start a new terminal session with claude and run /status. Check that Anthropic base URL shows your gateway and the API-key source is ANTHROPIC_API_KEY. Approve the key if Claude Code asks you to confirm it.

For the local Manager gateway, sync writes ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY into settings.json, removes its old ANTHROPIC_AUTH_TOKEN, and sets the top-level model. It also clears ANTHROPIC_MODEL and the Sonnet, Opus and Haiku default-model variables in that file. The .claude.json file is updated to mark onboarding complete.

In the Web UI, sync writes on the machine running Manager. For a laptop client connected to a server gateway, configure the client on the laptop. If Claude Code reports invalid JSON in a settings file, fix that file before syncing.

Connect manually with Bash, PowerShell or JSON

Set ANTHROPIC_BASE_URL to the gateway root and ANTHROPIC_API_KEY to Manager’s gateway key. Claude Code adds /v1/messages to the root address.

The examples use port 8045. Change it to your configured port before running them. For a gateway on another machine, use its reachable address and follow the remote-access setup.

Temporary Bash connection · macOS / Linux / WSL

Run bash first if you use another shell. Paste the block, then enter the key and model at the prompts. The key input is hidden; the connection variables return to their previous state when Claude Code exits.

Bash · hidden key input
(
  read -r -s -p "Gateway API key: " AG_CLAUDE_KEY || exit 1
  printf '\n'
  read -r -p "Available model ID: " AG_CLAUDE_MODEL || exit 1
  if [[ -z "$AG_CLAUDE_KEY" || -z "$AG_CLAUDE_MODEL" ]]; then
    printf 'Enter both a key and a model ID.\n' >&2
    exit 1
  fi
  unset ANTHROPIC_AUTH_TOKEN
  unset CLAUDE_CODE_USE_BEDROCK CLAUDE_CODE_USE_VERTEX
  unset CLAUDE_CODE_USE_FOUNDRY
  ANTHROPIC_BASE_URL="http://127.0.0.1:8045" \
  ANTHROPIC_API_KEY="$AG_CLAUDE_KEY" \
  claude --model "$AG_CLAUDE_MODEL"
)
Temporary PowerShell connection · Windows

Paste this block into PowerShell. It saves the relevant environment values, starts Claude Code with the gateway settings, then restores the saved values when the command returns, including after an error.

PowerShell · hidden key input
& {
  $agNames = @(
    'ANTHROPIC_BASE_URL', 'ANTHROPIC_API_KEY',
    'ANTHROPIC_AUTH_TOKEN', 'CLAUDE_CODE_USE_BEDROCK',
    'CLAUDE_CODE_USE_VERTEX', 'CLAUDE_CODE_USE_FOUNDRY'
  )
  $agSaved = @{}
  foreach ($agName in $agNames) {
    $agSaved[$agName] = [Environment]::GetEnvironmentVariable($agName, 'Process')
  }
  $agSecret = $null
  try {
    $agSecret = Read-Host "Gateway API key" -AsSecureString
    $agModel = Read-Host "Available model ID"
    if ($agSecret.Length -eq 0 -or [string]::IsNullOrWhiteSpace($agModel)) {
      throw "Enter both a key and a model ID."
    }
    foreach ($agName in $agNames) {
      Remove-Item "Env:$agName" -ErrorAction SilentlyContinue
    }
    $env:ANTHROPIC_BASE_URL = "http://127.0.0.1:8045"
    $env:ANTHROPIC_API_KEY = ([Net.NetworkCredential]::new('', $agSecret)).Password
    claude --model $agModel
    if ($LASTEXITCODE -ne 0) {
      Write-Warning "Claude Code exited with code $LASTEXITCODE."
    }
  }
  finally {
    foreach ($agName in $agNames) {
      if ($null -eq $agSaved[$agName]) {
        Remove-Item "Env:$agName" -ErrorAction SilentlyContinue
      }
      else {
        [Environment]::SetEnvironmentVariable($agName, $agSaved[$agName], 'Process')
      }
    }
    if ($null -ne $agSecret) { $agSecret.Dispose() }
  }
}

Both temporary commands clear an inherited Bearer token and the Bedrock, Vertex and Foundry routing switches for this launch. Settings-file values still apply. After startup, use /status to confirm the destination and credential source.

Persistent settings.json example

Merge these keys into your private user settings, replacing MODEL_ID and GATEWAY_API_KEY. Keep unrelated entries and remove any stale ANTHROPIC_AUTH_TOKEN in the same env block. Store the key outside shared project files.

Private user settings · JSON
{
  "model": "MODEL_ID",
  "env": {
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:8045",
    "ANTHROPIC_API_KEY": "GATEWAY_API_KEY"
  }
}

Save and restart Claude Code. If you set CLAUDE_CONFIG_DIR, edit the settings.json that your client loads there.

Claude Code sends ANTHROPIC_API_KEY in x-api-key. The alternative ANTHROPIC_AUTH_TOKEN uses Bearer authorization; Manager accepts both. Keep one active credential source to avoid a stale token taking priority. See Claude Code’s gateway connection instructions.

Choose the model for the session

Start with claude --model MODEL_ID, using the same ID that worked through Manager’s API. The temporary commands above pass this option for you.

Check Manager’s request log for the routed model. If you use aliases such as Sonnet or Opus, configure them against models your gateway actually serves; the model-routing guide explains the mapping.

To change models inside Claude Code, use /model. The current picker lets you press s for a session-only change; entering /model MODEL_ID saves that choice as your default. See model selection and persistence.

Get the main conversation working first. Then test any subagents or background tasks you use, because they can select a different model.

Test a reply and a file edit

Create an empty test folder outside your working project and add a UTF-8 file named task.txt with these two lines. This gives you a small change you can inspect yourself.

marker=AG-CLAUDE-7C9
status=pending
Create the test folder automatically with Python 3

Save this as prepare_smoke.py. Run python3 prepare_smoke.py on macOS/Linux or py prepare_smoke.py on Windows. It creates the file in a new temporary directory and prints the directory path.

Python 3 · prepare the test file
from pathlib import Path
import tempfile

folder = Path(tempfile.mkdtemp(prefix="ag-claude-smoke-"))
(folder / "task.txt").write_text(
    "marker=AG-CLAUDE-7C9\nstatus=pending\n", encoding="utf-8"
)
print(folder)
  1. Open the test folder in your terminal. Use cd with the folder’s path, then launch Claude Code using your chosen connection method. Start a new conversation and keep normal permission checks enabled.
  2. Check a reply. Ask “Reply with ready. Do not use tools.” Wait for a complete answer and confirm the request reached Manager.
  3. Ask for the edit. Send the prompt below. Review any permission request for task.txt, then watch the read, edit and follow-up read complete.
Prompt · edit only task.txt
Use the file-reading tool to read task.txt, then use a file-editing tool to replace only status=pending with status=done. Preserve the marker and the rest of the file. Read it again to confirm the change. Do not run shell commands or change any other files.

Open task.txt in your editor. The marker should still read AG-CLAUDE-7C9 and the second line should now read status=done. Check that the rest of the folder is unchanged.

Check the file contents with Python 3

For the file created by the Python preparation script, save this verifier outside the test folder as verify_smoke.py. From inside the test folder, run it using its full path: python3 /path/to/verify_smoke.py or py C:\path\to\verify_smoke.py. It checks both lines and the final newline.

Python 3 · verify on-disk contents
from pathlib import Path

try:
    actual = Path("task.txt").read_text(encoding="utf-8")
except (OSError, UnicodeError):
    raise SystemExit("FAIL: open the test folder and check task.txt.")
expected = "marker=AG-CLAUDE-7C9\nstatus=done\n"
if actual == expected:
    print("PASS: task.txt contains the intended edit.")
else:
    raise SystemExit("FAIL: file does not match the expected edit.")

Check the next message in the same conversation. Send this follow-up and look for a fresh file read, followed by the unchanged marker and done status:

Prompt · read the edited file again
Use the file-reading tool again to read task.txt. Report the marker and current status from the file without changing anything.

Once the reply, edit on disk and follow-up read all work, try the same connection in your project with its normal settings.

Check that streaming finishes

Ask for a short five-item explanation of the test file, with no further changes. Watch the reply arrive, finish, and return control to the input prompt.

If it stalls, note the time to first visible output, how long you waited, and the last visible action. For a completed reply, record the time to completion. If retries keep repeating, press Ctrl+C to interrupt and check the file before retrying an edit.

Use the streaming and tool-error guide for interrupted streams, missing tool results and signature errors. If you depend on session recovery after a gateway restart, test that separately after the uninterrupted conversation works.

Fix connection and tool problems

Start with /status and the first failing action. The address, credential source, model and request log help you choose the next check.

Claude Code still uses the previous provider
Restart the CLI after removing an override. Check ~/.claude/settings.json, project .claude/settings.json and .claude/settings.local.json, your shell profile, and CC Switch if you use it. A custom CLAUDE_CONFIG_DIR changes the user settings location. The settings precedence guide explains which file wins.
/status shows Bedrock, Vertex or Foundry
Check for CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX or CLAUDE_CODE_USE_FOUNDRY in your launch environment and saved settings. Remove the old switch from the configuration you control, then restart. The environment-variable reference covers provider selection.
The client asks to log in or warns about conflicting credentials
Confirm the gateway key reached the process and approve its use when prompted. Check for a stale Bearer token or apiKeyHelper in your settings. Keep your saved login available for restoring the previous connection.
401, 403 or a URL containing /v1/v1/messages
Compare the API key and root URL with Manager. A 403 can also come from token or access restrictions. Remove the extra /v1 from the base URL and use the gateway connection checks.
Text works, but task.txt stays unchanged
Check whether file access was allowed, an editing tool was called, and its result returned. If the tool reported success, inspect the actual file path. For Field required, save the exact field name and the first failing tool step for diagnosis.
A new conversation works while the old one fails
Save the context you need, then start a fresh conversation for the test. /clear starts a new session; /compact summarizes the existing context. Keep a copy of important details before either action.
Errors started after a client update
Record both versions and compare the short test in a fresh conversation. Manager 5.0.0’s Claude Code notes discuss the 2.1.28x and 2.1.293–2.1.295 releases. Check the release notes for your installed pair before choosing an update or rollback.

For a persistent failure, collect the version pair, OS, gateway address with secrets removed, selected model, exact error and last completed test step. Follow the bug-report checklist. For quota or availability errors, use the 429 and 503 guide.

Restore your previous connection

Exit Claude Code, undo the configuration method you used, then reopen it and confirm the previous provider with /status and a short message.

  1. Temporary terminal setup: the Bash block ends with its subprocess; the PowerShell block restores the environment in its final cleanup. Also undo any saved settings you edited before running the command.
  2. Manual JSON or Manager sync: restore your dated copies of the affected files. If a file was newly created, review its contents and remove only the gateway changes you introduced.
  3. Manager backup: check the dates and contents of both .antigravity.bak files before choosing Restore Backup. Keep an extra copy: Manager moves each backup into place. Review both client files afterward, especially if only one backup existed.
  4. CC Switch: return to your previous profile if you changed it. Restart Claude Code after removing persistent gateway overrides.

If no automatic backup exists, Restore Defaults sets the official provider URL and clears the gateway key. Use your own saved files to recover custom models, credentials and other earlier settings.

After checking the result, remove the disposable test folder and stop the proxy if you have finished using it.

Related guides

Return to AI client connections for another application, or continue with one of these tasks:

WINDOWS DOWNLOAD

Archive password

Keep this password to open your Windows download if prompted.