Antigravity CLI and AI Hub
Run Antigravity CLI (agy) through AI Hub's v1beta GenerateContent route with an optional terminal command.
AI Hub serves /api/v1beta/models/{model}:streamGenerateContent, :generateContent and GET /api/v1beta/models for agy. Built-in Gemini 4 models (gemini-4-argon, gemini-4-hydrogen, gemini-4-carbon) map automatically to google/gemini-4-*. Local agy tools, streaming and thoughtSignature replay are supported; provider-hosted search and code execution remain unavailable.
Quickstart with the AI Hub CLI (experimental): on macOS or Linux with Node.js 22+ and agy >= 1.5.0, run npm install -g belive-aihub && aihub setup && aihub agy (see AI Hub CLI). aihub agy uses session-only agy --settings on your real HOME without an overlay folder. Keep reading for manual shell setup.
1. Install and check Antigravity CLI
Check your installed agy binary and available Gemini 4 tiers:
agy --help agy models
2. Prepare your key
Create a dedicated workspace inference key and set a spend cap. Each agent turn sends workspace context, instructions and tool declarations.
Load your key into TOKENHUB_API_KEY from your secret manager or shell profile (avoid printing it or committing it):
printf 'AI Hub API key: ' read -r -s TOKENHUB_API_KEY printf '\n' export TOKENHUB_API_KEY
3. Add an isolated agy-aihub command
agy uses "modelProvider": "gemini" in ~/.gemini/antigravity-cli/settings.json when routing to a custom endpoint. To keep your ordinary Google-account agy login untouched, isolate the AI Hub settings.json in ~/.agy-aihub-home and launch with this Bash or Zsh function:
agy-aihub() ( : "${TOKENHUB_API_KEY:?Load your AI Hub key into TOKENHUB_API_KEY first}" local overlay="$HOME/.agy-aihub-home" mkdir -p "$overlay/.gemini/antigravity-cli" for item in "$HOME"/.* "$HOME"/*; do local base="${item:t}" [[ "$base" == "." || "$base" == ".." || "$base" == ".gemini" || "$base" == ".agy-aihub-home" ]] && continue [[ -e "$overlay/$base" ]] || ln -s "$item" "$overlay/$base" 2>/dev/null done for item in "$HOME/.gemini"/*; do local base="${item:t}" [[ "$base" == "antigravity-cli" ]] && continue [[ -e "$overlay/.gemini/$base" ]] || ln -s "$item" "$overlay/.gemini/$base" 2>/dev/null done if [[ ! -f "$overlay/.gemini/antigravity-cli/settings.json" ]]; then printf '{"modelProvider":"gemini","model":"Gemini 4 Argon (Medium)"}\n' > "$overlay/.gemini/antigravity-cli/settings.json" chmod 600 "$overlay/.gemini/antigravity-cli/settings.json" fi HOME="$overlay" \ GEMINI_API_KEY="$TOKENHUB_API_KEY" \ GOOGLE_GEMINI_BASE_URL="https://tokenhub-api.belive.sg/api" \ command agy "$@" )
agy appends /v1beta/models/{model}:streamGenerateContent?alt=sse to GOOGLE_GEMINI_BASE_URL; use the base ending in /api, without /v1beta.
4. Choose a Gemini 4 model and effort
agy flag | AI Hub model | Supported effort |
|---|---|---|
--model gemini-4-argon-medium | google/gemini-4-argon | low, medium, high |
--model gemini-4-hydrogen-medium | google/gemini-4-hydrogen | low, medium, high, xhigh |
--model gemini-4-carbon-high | google/gemini-4-carbon | low, medium, high |
agy-aihub -p "Reply with AIHUB_OK" agy-aihub --model gemini-4-hydrogen-medium agy-aihub --model gemini-4-carbon-high
Open Activity to verify the model, usage and recorded cost. Plain agy keeps using your normal Google account.
5. Connect the AI Hub MCP server
Give agy live AI Hub docs and model-catalogue tools:
agy mcp add tokenhub https://aihub.belive.sg/mcpLimits and troubleshooting
- Query-string
?key=credentials are refused with HTTP400;agysendsx-goog-api-keyautomatically. agysendsmaxOutputTokens: 65536; AI Hub clamps Argon and Carbon to32768on the non-continuation chat path and listsgenerationConfig.maxOutputTokensinX-TokenHub-Ignored-Fields. Hydrogen keeps65536.cachedContent,candidateCount > 1,fileDataURIs and provider-hosted search/code-execution tools are refused with HTTP400.- See GenerateContent for the full wire contract.