> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ccs.kaitran.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# Antigravity Provider

> Access Claude Opus 4.6 and Gemini 3 Pro via Antigravity OAuth

# Antigravity Provider

Access premium AI models (Claude Opus 4.6, Claude Sonnet 4.6, Gemini 3 Pro) through Antigravity's OAuth-based platform. Features real-time quota monitoring and multi-account support.

## Overview

Antigravity provides access to Claude and Gemini models through a subscription service. CCS integrates seamlessly with OAuth authentication and real-time quota tracking.

**Provider Identifier:** `agy`

**Command:** `ccs agy`

**Supported Models:**

* Claude Opus 4.6 Thinking (default) - Latest flagship with extended thinking
* Claude Opus 4.6 - Latest flagship standard
* Claude Sonnet 4.6 Thinking - Balanced with extended thinking
* Claude Sonnet 4.6 - Fast and capable
* Gemini 3 Pro - Google's latest model via Antigravity
* Interactive model picker via `--config`

<Note>
  Claude 4.5 model IDs are deprecated in AGY as of v7.51. Existing sessions referencing 4.5 model IDs are automatically migrated to their 4.6 equivalents. Re-run `ccs doctor --fix` if you see 502 errors after upgrading.
</Note>

<Warning>
  Do not reuse the same Google account for both `ccs gemini` and `ccs agy`. Using one Google account across both providers causes token conflicts and authentication failures (see issue #509). Use separate Google accounts for each provider.
</Warning>

## Authentication

### First-Time Setup

```bash theme={null}
# Run Antigravity for the first time
ccs agy "analyze this code"

# Browser opens automatically
# → Complete OAuth login
# → Token cached at ~/.ccs/cliproxy/auth/
# → Future runs require no re-auth
```

**Authentication Flow:**

1. Authorization Code flow via browser callback
2. OAuth tokens include project\_id for quota API access
3. Token cached locally with auto-refresh
4. Proactive token refresh prevents mid-request failures

### Manual Authentication

```bash theme={null}
# Authenticate without starting a session
ccs agy --auth

# Headless mode (server/SSH environments)
ccs agy --headless
# → Displays URL for manual browser authentication
# → Includes SSH tunnel instructions if needed
```

### Logout

```bash theme={null}
# Clear all Antigravity tokens
ccs agy --logout
```

## Real-Time Quota Display

**Unique Feature:** CCS displays real-time quota percentages for Antigravity accounts.

```bash theme={null}
# Quota checked automatically before execution
ccs agy "your prompt"

# Output before Claude starts:
# [i] Antigravity Quota:
#     Claude Opus 4.5 Thinking: 85% used (resets 2024-01-05 23:59:59 UTC)
#     Gemini 3 Pro: 42% used (resets 2024-01-05 23:59:59 UTC)
```

**Quota API Integration:**

* Fetches from Antigravity internal API
* Displays usage percentage (0-100%)
* Shows reset time for each model
* Auto-refreshes tokens if expired

**Error Handling:**

* **403 Forbidden:** Account lacks quota access (displays warning)
* **Unprovisioned:** Account not activated in Antigravity app (prompts to sign in)
* **Token Expired:** Auto-refreshes via Google OAuth

## Multi-Account Support

Manage multiple Antigravity accounts for quota rotation:

### Add Account

```bash theme={null}
# Add new account (preserves existing)
ccs agy --auth --add
```

### List Accounts

```bash theme={null}
# Show all authenticated Antigravity accounts
ccs agy --accounts

# Output:
# Accounts for agy:
#   [default] work (work@company.com) - Quota: 85%
#   personal (personal@gmail.com) - Quota: 12%
```

### Switch Account

```bash theme={null}
# Switch to specific account by nickname
ccs agy --use personal

# Next command uses personal's account
ccs agy "your prompt"
```

### Rename Account

```bash theme={null}
# Rename default account nickname
ccs agy --nickname main-account
```

**Account Registry:** `~/.ccs/cliproxy/accounts.json`

**Auto-Nicknames:** Generated from email prefix (e.g., `john@gmail.com` → `john`)

## Model Configuration

Antigravity supports interactive model selection with extended context support:

```bash theme={null}
# Open model picker
ccs agy --config

# Interactive menu appears:
# Available models for Antigravity:
# 1. Claude Opus 4.6 Thinking (Recommended, default)
# 2. Claude Opus 4.6
# 3. Claude Sonnet 4.6 Thinking
# 4. Claude Sonnet 4.6
# 5. Gemini 3 Pro
# 6. Gemini 3 Pro Preview
# Select model [1-6]:
```

**Model Settings:** `~/.ccs/agy.settings.json`

**First-Run Behavior:** Prompts for model selection before first execution

**Extended Context Support:**

* Claude Opus 4.6: Use `--1m` flag for 1M token window (opt-in)
* Gemini 3 Pro: 1M token window auto-enabled by default
* Other models: Standard context windows

**Auto-Rotation:** CLIProxyAPI can auto-rotate accounts on rate limit (configured in `config.yaml`)

## Commands

### Basic Usage

```bash theme={null}
# Run with Antigravity
ccs agy "explain this architecture"

# Interactive chat
ccs agy
```

### Authentication Flags

| Flag           | Description                     |
| -------------- | ------------------------------- |
| `--auth`       | Trigger OAuth flow (no session) |
| `--logout`     | Clear all tokens                |
| `--headless`   | Display URL for remote auth     |
| `--auth --add` | Add new account (keep existing) |

### Account Management Flags

| Flag                | Description                       |
| ------------------- | --------------------------------- |
| `--accounts`        | List all accounts with quota info |
| `--use <nickname>`  | Switch default account            |
| `--nickname <name>` | Rename default account            |

### Configuration Flags

| Flag       | Description              |
| ---------- | ------------------------ |
| `--config` | Interactive model picker |

## Storage Locations

| Path                                      | Purpose                         |
| ----------------------------------------- | ------------------------------- |
| `~/.ccs/cliproxy/auth/antigravity-*.json` | OAuth tokens (one per account)  |
| `~/.ccs/cliproxy/accounts.json`           | Account registry with nicknames |
| `~/.ccs/agy.settings.json`                | Model configuration             |
| `~/.ccs/cliproxy/config.yaml`             | CLIProxy unified config         |

## Quota Management

### Pre-flight Check

CCS checks account quota before starting sessions:

```bash theme={null}
# Automatic quota check before execution
ccs agy "your prompt"
# → Checks all accounts, selects healthiest one
# → Skips exhausted or paused accounts
```

**Configuration:**

```yaml theme={null}
# config.yaml
quota_management:
  mode: hybrid  # auto | manual | hybrid
  auto:
    preflight_check: true      # Check before request
    exhaustion_threshold: 5    # Skip accounts below 5%
    tier_priority: ["paid"]    # Prefer paid accounts
    cooldown_minutes: 5        # Skip exhausted for 5min
```

### Pause/Resume Accounts

Manually control which accounts are used:

```bash theme={null}
# Pause an account from rotation
ccs cliproxy pause agy user@gmail.com

# Resume a paused account
ccs cliproxy resume agy user@gmail.com

# Check status of all accounts
ccs cliproxy status agy
```

**Dashboard:** Pause/resume toggles also available in web dashboard account dropdown.

### Project ID Display

Dashboard shows GCP project\_id for each Antigravity account:

* **Location:** OAuth Providers → Antigravity → Account dropdown
* **Field:** Read-only with folder icon (`FolderCode`)
* **Privacy:** Respects privacy blur mode (Settings → Privacy)
* **Tooltip:** "GCP Project ID (read-only)"

**Warning State:** If project\_id shows "N/A" with warning badge:

* **Cause:** Account authenticated before project\_id tracking
* **Impact:** Quota API calls may fail
* **Solution:** Re-authenticate to refresh token with project\_id

```bash theme={null}
# Fix missing project_id
ccs agy --logout
ccs agy --auth
# Verify in Dashboard: OAuth Providers → Antigravity
```

### Account Tiers

Antigravity accounts have tier classifications for quota prioritization:

**Tier Types:**

| Tier      | Description                            | Priority |
| --------- | -------------------------------------- | -------- |
| `ultra`   | Premium tier with highest limits       | Highest  |
| `pro`     | Professional tier with standard limits | Medium   |
| `free`    | Free tier with limited quota           | Lowest   |
| `unknown` | Tier detection failed                  | Lowest   |

**Tier Storage:** `~/.ccs/cliproxy/accounts.json` → `.providers.agy.accounts[].tier`

**Tier Prioritization:**

CCS uses tier information for intelligent account selection:

```yaml theme={null}
# config.yaml
quota_management:
  auto:
    tier_priority: ["ultra", "pro", "free"]  # Selection order
```

When multiple accounts are available, CCS prefers higher-tier accounts:

1. Select accounts with quota above threshold
2. Sort by tier (ultra, pro, free — highest first)
3. Use highest-tier account with available quota

**Dashboard Display:**

Tier badges appear in:

* Account list (`ccs agy --accounts`)
* Dashboard OAuth Providers → Antigravity dropdown
* Quota status cards

**Tier Detection:**

CCS reads the live Antigravity tier from `loadCodeAssist` whenever quota refresh runs. Manual tier values in `accounts.json` or the Dashboard remain useful as a fallback when the provider cannot return tier evidence.

### Token Format

```json theme={null}
{
  "type": "antigravity",
  "access_token": "...",
  "refresh_token": "...",
  "email": "user@example.com",
  "expired": "2024-12-31T23:59:59Z",
  "project_id": "..."
}
```

**Project ID:** Required for quota API calls, obtained during OAuth flow

### Quota API Endpoints

CCS uses Antigravity's internal API:

1. **loadCodeAssist** - Get project ID and tier evidence. CCS tries the daily Cloud Code host first and falls back to the production host if needed.
2. **fetchAvailableModels** - Get quota percentages & reset times

**Authentication:** OAuth tokens from `~/.ccs/cliproxy/auth/antigravity-*.json`

**Auto-Refresh:** Tokens refresh automatically if expired or expiring soon (under 5 minutes)

### Quota Response

```typescript theme={null}
{
  models: [
    {
      name: "gemini-3-pro-high",
      displayName: "Gemini 3 Pro",
      percentage: 85,  // 0-100
      resetTime: "2024-01-05T23:59:59Z"
    }
  ],
  lastUpdated: 1704499200000,
  isForbidden: false,
  isUnprovisioned: false
}
```

## Requirements

* Antigravity subscription
* Browser for OAuth (or `--headless` for servers)
* Network access to Antigravity authentication servers

## Troubleshooting

### Quota Not Displaying

```bash theme={null}
# Check account status
ccs agy --accounts

# Re-authenticate if needed
ccs agy --logout
ccs agy --auth
```

### Account Unprovisioned

**Error:** "Account not activated in Antigravity app"

**Solution:** Sign in to Antigravity web app at least once to provision your account

### 403 Forbidden on Quota API

**Error:** "Account lacks quota access"

**Solution:** Verify subscription is active. Contact Antigravity support if issue persists.

### Project ID Shows N/A

**Warning:** "Project ID: N/A" in Dashboard account dropdown

**Cause:** OAuth token missing project\_id (authenticated before feature added)

**Solution:**

1. Remove account: `ccs agy --logout`
2. Re-authenticate: `ccs agy --auth`
3. Verify in Dashboard: OAuth Providers → Antigravity → Account dropdown
4. Confirm project\_id displays (e.g., "project-123456")

**Note:** Re-authentication is required only once per account. Project ID persists after successful OAuth.

### Token Expiry

Tokens refresh automatically. If refresh fails:

```bash theme={null}
# Re-authenticate
ccs agy --auth
```

## Cost Information

**Antigravity Subscription Required:** Check antigravity.dev for current pricing

**Usage Limits:** Subject to quota limits shown in real-time display

## Next Steps

<CardGroup cols={1}>
  <Card title="Multi-Account Setup" icon="users" href="/tutorials/multi-account-setup">
    Manage multiple Antigravity accounts
  </Card>
</CardGroup>
