Skip to content

Instantly share code, notes, and snippets.

@taoalpha
Created January 14, 2026 04:25
Show Gist options
  • Select an option

  • Save taoalpha/22773d2132519e55a4c7427fd3e96d8e to your computer and use it in GitHub Desktop.

Select an option

Save taoalpha/22773d2132519e55a4c7427fd3e96d8e to your computer and use it in GitHub Desktop.
name description
antigravity-quota
Check Antigravity API quota status for all configured Google accounts

Antigravity Quota Checker

Check your Antigravity API quota status using curl commands.

Prerequisites

  • Antigravity accounts configured in ~/.config/opencode/antigravity-accounts.json
  • curl and jq installed

Usage

When user asks to check quota, run the following steps:

Step 1: Read Account Configuration

cat ~/.config/opencode/antigravity-accounts.json

Extract the refreshToken and projectId (or managedProjectId) for each account.

Step 2: Get Access Token

For each account, exchange the refresh token for an access token:

curl -s -X POST "https://oauth2.googleapis.com/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "client_id=1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com" \
  -d "client_secret=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" \
  -d "refresh_token=<REFRESH_TOKEN>" \
  -d "grant_type=refresh_token"

Step 3: Fetch Available Models with Quota

Use the access token to fetch quota information:

curl -s -X POST "https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -H "User-Agent: antigravity" \
  -d '{"project": "<PROJECT_ID>"}'

Combined One-Liner

For convenience, use this combined command (replace placeholders):

ACCESS_TOKEN=$(curl -s -X POST "https://oauth2.googleapis.com/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "client_id=1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com" \
  -d "client_secret=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" \
  -d "refresh_token=<REFRESH_TOKEN>" \
  -d "grant_type=refresh_token" | jq -r '.access_token') && \
curl -s -X POST "https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "User-Agent: antigravity" \
  -d '{"project": "<PROJECT_ID>"}' | jq '.'

Response Format

The API returns a models object with quota info for each model:

{
  "models": {
    "gemini-3-pro-high": {
      "displayName": "Gemini 3 Pro (High)",
      "quotaInfo": {
        "remainingFraction": 1,
        "resetTime": "2026-01-14T09:20:41Z"
      }
    }
  }
}
  • remainingFraction: 1.0 = 100%, 0.5 = 50%, 0 = exhausted
  • resetTime: ISO 8601 timestamp when quota resets

Output Presentation

Present the quota status in a readable table format:

Model Remaining Reset Time
Gemini 3 Pro (High) 100% Jan 14, 09:20 UTC
Claude Sonnet 4.5 74% Jan 14, 07:08 UTC
Use indicators:
  • 100% = Full quota available
  • 50-99% = Partially used (warning)
  • <50% = Low quota (alert)
  • 0% = Exhausted

API Constants

Constant Value
Client ID 1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com
Client Secret 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
Token URL https://oauth2.googleapis.com/token
CloudCode Base URL https://cloudcode-pa.googleapis.com
Fetch Models Endpoint /v1internal:fetchAvailableModels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment