> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/badrisnarayanan/antigravity-claude-proxy/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code Setup

> Configure Claude Code CLI to use the Antigravity Claude Proxy

This guide shows you how to configure the Claude Code CLI to route requests through the Antigravity Claude Proxy instead of using official Anthropic credits.

## Prerequisites

<Steps>
  <Step title="Install Claude Code CLI">
    Follow the official installation instructions at [claude.ai/code](https://claude.ai/code)
  </Step>

  <Step title="Start the proxy server">
    ```bash theme={null}
    acc start
    # or: antigravity-claude-proxy start
    ```

    Verify it's running:

    ```bash theme={null}
    curl http://localhost:8080/health
    ```
  </Step>

  <Step title="Add at least one Google account">
    See the [Account Management](/guides/account-management) guide for details:

    ```bash theme={null}
    antigravity-claude-proxy accounts add
    ```
  </Step>
</Steps>

## Configuration Methods

You can configure Claude Code in two ways:

<Tabs>
  <Tab title="Web Console (Recommended)">
    The easiest way to configure Claude Code:

    <Steps>
      <Step title="Open the web console">
        ```bash theme={null}
        acc ui
        # or navigate to: http://localhost:8080
        ```
      </Step>

      <Step title="Configure Claude CLI settings">
        1. Go to **Settings** → **Claude CLI**
        2. Toggle **Connection Mode**:
           * **Proxy Mode**: Uses local proxy server (Antigravity Cloud Code)
           * **Paid Mode**: Uses official Anthropic Credits
        3. Select your preferred models
        4. Click **Apply to Claude CLI**
      </Step>
    </Steps>

    <Warning>
      **Configuration Precedence**

      System environment variables (set in shell profile like `.zshrc`) take precedence over `settings.json`. If using the Web Console, ensure you haven't manually exported conflicting variables.
    </Warning>
  </Tab>

  <Tab title="Manual Configuration">
    Edit the Claude Code settings file directly:

    <Tabs>
      <Tab title="macOS">
        Create or edit `~/.claude/settings.json`
      </Tab>

      <Tab title="Linux">
        Create or edit `~/.claude/settings.json`
      </Tab>

      <Tab title="Windows">
        Create or edit `%USERPROFILE%\.claude\settings.json`
      </Tab>
    </Tabs>
  </Tab>
</Tabs>

## Settings.json Configuration

### Using Claude Models

Add this configuration to `settings.json`:

```json theme={null}
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "test",
    "ANTHROPIC_BASE_URL": "http://localhost:8080",
    "ANTHROPIC_MODEL": "claude-opus-4-6-thinking",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6-thinking",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-5-thinking",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-4-5",
    "CLAUDE_CODE_SUBAGENT_MODEL": "claude-sonnet-4-5-thinking",
    "ENABLE_EXPERIMENTAL_MCP_CLI": "true"
  }
}
```

<AccordionGroup>
  <Accordion title="Field Descriptions">
    * **ANTHROPIC\_AUTH\_TOKEN**: Set to `"test"` (any value works, proxy doesn't validate)
    * **ANTHROPIC\_BASE\_URL**: Proxy server address (default: `http://localhost:8080`)
    * **ANTHROPIC\_MODEL**: Primary model for requests
    * **ANTHROPIC\_DEFAULT\_OPUS\_MODEL**: Model used when you specify "opus"
    * **ANTHROPIC\_DEFAULT\_SONNET\_MODEL**: Model used when you specify "sonnet"
    * **ANTHROPIC\_DEFAULT\_HAIKU\_MODEL**: Model used when you specify "haiku"
    * **CLAUDE\_CODE\_SUBAGENT\_MODEL**: Model for sub-agents (use faster model)
    * **ENABLE\_EXPERIMENTAL\_MCP\_CLI**: Enable MCP (Model Context Protocol) support
  </Accordion>
</AccordionGroup>

### Using Gemini Models

To use Google Gemini models instead of Claude:

```json theme={null}
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "test",
    "ANTHROPIC_BASE_URL": "http://localhost:8080",
    "ANTHROPIC_MODEL": "gemini-3.1-pro-high[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "gemini-3.1-pro-high[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "gemini-3-flash[1m]",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3-flash[1m]",
    "CLAUDE_CODE_SUBAGENT_MODEL": "gemini-3-flash[1m]",
    "ENABLE_EXPERIMENTAL_MCP_CLI": "true"
  }
}
```

<Info>
  See the [Available Models](/configuration/models) documentation for a complete list of supported models and their capabilities.
</Info>

## Environment Variables

Alternatively, set environment variables in your shell profile:

<Tabs>
  <Tab title="macOS (Zsh)">
    Add to `~/.zshrc`:

    ```bash theme={null}
    export ANTHROPIC_BASE_URL="http://localhost:8080"
    export ANTHROPIC_AUTH_TOKEN="test"
    export ANTHROPIC_MODEL="claude-opus-4-6-thinking"
    ```

    Reload your shell:

    ```bash theme={null}
    source ~/.zshrc
    ```
  </Tab>

  <Tab title="macOS/Linux (Bash)">
    Add to `~/.bashrc`:

    ```bash theme={null}
    export ANTHROPIC_BASE_URL="http://localhost:8080"
    export ANTHROPIC_AUTH_TOKEN="test"
    export ANTHROPIC_MODEL="claude-opus-4-6-thinking"
    ```

    Reload your shell:

    ```bash theme={null}
    source ~/.bashrc
    ```
  </Tab>

  <Tab title="Windows (PowerShell)">
    Add to PowerShell profile:

    ```powershell theme={null}
    Add-Content $PROFILE "`n`$env:ANTHROPIC_BASE_URL = 'http://localhost:8080'"
    Add-Content $PROFILE "`$env:ANTHROPIC_AUTH_TOKEN = 'test'"
    Add-Content $PROFILE "`$env:ANTHROPIC_MODEL = 'claude-opus-4-6-thinking'"
    ```

    Reload profile:

    ```powershell theme={null}
    . $PROFILE
    ```
  </Tab>

  <Tab title="Windows (CMD)">
    Set persistent environment variables:

    ```cmd theme={null}
    setx ANTHROPIC_BASE_URL "http://localhost:8080"
    setx ANTHROPIC_AUTH_TOKEN "test"
    setx ANTHROPIC_MODEL "claude-opus-4-6-thinking"
    ```

    <Warning>Restart your terminal for changes to take effect</Warning>
  </Tab>
</Tabs>

## Proxy Mode vs Paid Mode

The web console allows you to toggle between two modes:

| Feature           | Proxy Mode                       | Paid Mode                         |
| ----------------- | -------------------------------- | --------------------------------- |
| **Backend**       | Local proxy server (Antigravity) | Official Anthropic API            |
| **Cost**          | Free (uses Google Cloud quotas)  | Paid (requires Anthropic credits) |
| **Models**        | Claude + Gemini                  | Claude only                       |
| **Configuration** | Sets proxy URL in settings.json  | Clears proxy settings             |

<Tip>
  **Paid Mode** automatically removes proxy settings from `settings.json` so you can use your official Anthropic account without conflicts.
</Tip>

## Verification Steps

Confirm Claude Code is using the proxy:

<Steps>
  <Step title="Check proxy is running">
    ```bash theme={null}
    acc status
    ```

    Should show: `Proxy is running (PID: xxxx)`
  </Step>

  <Step title="Run Claude Code">
    ```bash theme={null}
    claude
    ```

    If prompted to select a login method, add this to `~/.claude.json` (macOS/Linux) or `%USERPROFILE%\.claude.json` (Windows):

    ```json theme={null}
    {
      "hasCompletedOnboarding": true
    }
    ```

    Then restart your terminal.
  </Step>

  <Step title="Test a request">
    Send a simple prompt to Claude:

    ```
    > What is 2+2?
    ```

    Check proxy logs:

    ```bash theme={null}
    acc start --log
    ```

    You should see request logs showing which account and model were used.
  </Step>
</Steps>

## Advanced Configurations

### Multiple Claude Code Instances

Run both official Claude Code and Antigravity version simultaneously:

<Tabs>
  <Tab title="macOS/Linux">
    Add alias to `~/.zshrc` or `~/.bashrc`:

    ```bash theme={null}
    alias claude-antigravity='CLAUDE_CONFIG_DIR=~/.claude-account-antigravity ANTHROPIC_BASE_URL="http://localhost:8080" ANTHROPIC_AUTH_TOKEN="test" command claude'
    ```

    Usage:

    ```bash theme={null}
    claude           # Official API with your credits
    claude-antigravity  # Proxy server with free quota
    ```
  </Tab>

  <Tab title="Windows (PowerShell)">
    Add to PowerShell `$PROFILE`:

    ```powershell theme={null}
    function claude-antigravity {
        $env:CLAUDE_CONFIG_DIR = "$env:USERPROFILE\.claude-account-antigravity"
        $env:ANTHROPIC_BASE_URL = "http://localhost:8080"
        $env:ANTHROPIC_AUTH_TOKEN = "test"
        claude
    }
    ```

    Usage:

    ```powershell theme={null}
    claude           # Official API
    claude-antigravity  # Proxy server
    ```
  </Tab>
</Tabs>

### Custom Proxy Port

If you're running the proxy on a different port:

```bash theme={null}
# Start proxy on custom port
PORT=3001 acc start
```

Update `settings.json`:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://localhost:3001"
  }
}
```

### Running as systemd Service

When running the proxy as a systemd service, set `CLAUDE_CONFIG_PATH` to point to the real user's `.claude` directory:

```ini theme={null}
# /etc/systemd/system/antigravity-proxy.service
[Service]
Environment=CLAUDE_CONFIG_PATH=/home/youruser/.claude
ExecStart=/usr/bin/node /path/to/antigravity-claude-proxy/src/index.js
```

Without this, the WebUI's Claude CLI tab won't be able to read or write your Claude Code configuration.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Claude Code still using official API">
    Check configuration precedence:

    1. Verify environment variables aren't overriding `settings.json`:
       ```bash theme={null}
       echo $ANTHROPIC_BASE_URL
       ```
    2. If set, unset them:
       ```bash theme={null}
       unset ANTHROPIC_BASE_URL
       unset ANTHROPIC_AUTH_TOKEN
       ```
    3. Restart your terminal
  </Accordion>

  <Accordion title="Connection refused error">
    Ensure the proxy server is running:

    ```bash theme={null}
    acc status
    # If not running:
    acc start
    ```

    Check the port matches your configuration:

    ```bash theme={null}
    curl http://localhost:8080/health
    ```
  </Accordion>

  <Accordion title="Invalid authentication token">
    The proxy doesn't validate tokens. If you see this error, Claude Code may be trying to use the official API instead of the proxy.

    Verify `ANTHROPIC_BASE_URL` is set correctly:

    ```json theme={null}
    {
      "env": {
        "ANTHROPIC_BASE_URL": "http://localhost:8080"
      }
    }
    ```
  </Accordion>

  <Accordion title="Web Console can't modify settings.json">
    Check file permissions:

    ```bash theme={null}
    ls -la ~/.claude/settings.json
    ```

    If running as a systemd service, set `CLAUDE_CONFIG_PATH`:

    ```bash theme={null}
    export CLAUDE_CONFIG_PATH=/home/youruser/.claude
    ```
  </Accordion>

  <Accordion title="Claude Code asks to select login method">
    Bypass onboarding by adding to `~/.claude.json`:

    ```json theme={null}
    {
      "hasCompletedOnboarding": true
    }
    ```

    Restart your terminal after making this change.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Load Balancing" icon="scale-balanced" href="/guides/load-balancing">
    Configure multi-account strategies for optimal performance
  </Card>

  <Card title="Available Models" icon="brain" href="/configuration/models">
    Explore supported Claude and Gemini models
  </Card>

  <Card title="Web Console" icon="browser" href="/guides/web-console">
    Monitor usage and manage accounts visually
  </Card>

  <Card title="Account Management" icon="users" href="/guides/account-management">
    Add and configure Google accounts
  </Card>
</CardGroup>
