Antigravity CLI
Use FreshRouter's Gemini models in Google's Antigravity CLI (agy): one command, or one prompt for your agent.
The Antigravity CLI (agy) is Google's coding agent for the terminal. With FreshRouter it runs on Gemini models, starting with Gemini 4 Neon, and is paid from your FreshRouter balance.
There are two ways to set up the Antigravity CLI, and neither asks you to pick a model: run one command, or paste one prompt into a coding agent. Right after you create a key, the console shows both with your key already filled in, and its Connect page has them any time later.
Run one command
On macOS and Linux it asks for your API key. On Windows, paste the lines into PowerShell with your key in them:
curl -fsSL https://freshrouter.com/install/agy.sh | bashTo skip the question, put the key after bash -s --. The console fills it in for you.
curl -fsSL https://freshrouter.com/install/agy.sh | bash -s -- sk-your-freshrouter-keyPut your key in place of sk-your-freshrouter-key. The console fills it in for you.
irm https://antigravity.google/cli/install.ps1 | iex
[Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "sk-your-freshrouter-key", "User")
[Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://freshrouter.com/v1", "User")
$f = "$HOME\.gemini\antigravity-cli\settings.json"; New-Item -ItemType Directory -Force (Split-Path $f) | Out-Null
if (Test-Path $f) { Copy-Item $f "$f.backup" -Force }
[IO.File]::WriteAllText($f, '{"modelProvider":"gemini","model":"Gemini 4 Neon (High)"}')
Write-Host "Done. Open a new PowerShell window and start it with: agy"The command does three things and backs up the files it changes first:
- installs the Antigravity CLI with Google's own installer, if it isn't installed yet;
- in
~/.gemini/antigravity-cli/settings.json, switches agy to the Gemini API and starts it onGemini 4 Neon (High), keeping the rest of the file (on Windows the file is written anew, and the old one stays beside it assettings.json.backup); - puts your key into
GEMINI_API_KEYand FreshRouter's address intoGOOGLE_GEMINI_BASE_URL: in your shell profile on macOS and Linux (~/.zshrcon a Mac), as user environment variables on Windows.
Then open a new terminal window, since only new windows see the variables, and start it:
agy/model.Or have your coding agent do it
Paste this into a coding agent on the same computer. It asks you for your key, runs the command above and falls back to making the change by hand.
Set up the Antigravity CLI (Google's agy command) on this computer to use FreshRouter. First ask me for my FreshRouter API key (it starts with sk-), then put it below in place of <key>.
Run this in a terminal (macOS or Linux):
curl -fsSL https://freshrouter.com/install/agy.sh | bash -s -- <key>
On Windows, run this in PowerShell instead:
irm https://antigravity.google/cli/install.ps1 | iex
[Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "<key>", "User")
[Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://freshrouter.com/v1", "User")
$f = "$HOME\.gemini\antigravity-cli\settings.json"; New-Item -ItemType Directory -Force (Split-Path $f) | Out-Null
if (Test-Path $f) { Copy-Item $f "$f.backup" -Force }
[IO.File]::WriteAllText($f, '{"modelProvider":"gemini","model":"Gemini 4 Neon (High)"}')
Write-Host "Done. Open a new PowerShell window and start it with: agy"
It installs agy with Google's installer if it's missing, switches it to the Gemini API with a FreshRouter Gemini model in ~/.gemini/antigravity-cli/settings.json (keeping the rest of the file and backing it up first), and puts GEMINI_API_KEY and GOOGLE_GEMINI_BASE_URL into my shell profile. In PowerShell the lines do the same with user environment variables, and write settings.json anew, keeping the old one as settings.json.backup. It's safe to run again.
If you can't run the command, make the same change by hand: set the environment variables GEMINI_API_KEY to my key and GOOGLE_GEMINI_BASE_URL to "https://freshrouter.com/v1" (in my shell profile, or as user environment variables on Windows), and in ~/.gemini/antigravity-cli/settings.json (%USERPROFILE%\.gemini\antigravity-cli\settings.json on Windows) set "modelProvider": "gemini" and "model": "Gemini 4 Neon (High)", keeping everything else in the file. "model" must be the name agy shows in /model, not a model ID.
Don't ask me which model to use: it starts on Gemini 4 Neon, and I'll switch with /model. When it's done, tell me to open a new terminal window and start it with: agyChange the model and the reasoning level
Inside agy, /model lists Gemini models by name and reasoning level, like Gemini 4 Neon (High), and /effort changes the level. Pick a Gemini model that's on your Models page. To start the setup on another one, add its ID:
curl -fsSL https://freshrouter.com/install/agy.sh | bash -s -- sk-your-freshrouter-key --model gemini-3.8-flashirm https://antigravity.google/cli/install.ps1 | iex
[Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "sk-your-freshrouter-key", "User")
[Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://freshrouter.com/v1", "User")
$f = "$HOME\.gemini\antigravity-cli\settings.json"; New-Item -ItemType Directory -Force (Split-Path $f) | Out-Null
if (Test-Path $f) { Copy-Item $f "$f.backup" -Force }
[IO.File]::WriteAllText($f, '{"modelProvider":"gemini","model":"Gemini 3.8 Flash (High)"}')
Write-Host "Done. Open a new PowerShell window and start it with: agy"Set it up by hand
Set two environment variables, in your shell profile on macOS and Linux:
export GEMINI_API_KEY="sk-your-freshrouter-key"
export GOOGLE_GEMINI_BASE_URL="https://freshrouter.com/v1"On Windows, set them as user environment variables. Then set two keys in ~/.gemini/antigravity-cli/settings.json (%USERPROFILE%\.gemini\antigravity-cli\settings.json on Windows) and keep the rest of the file:
{
"modelProvider": "gemini",
"model": "Gemini 4 Neon (High)"
}"model"takes the name agy shows in/model, not the model's ID.- Without
"modelProvider": "gemini", agy doesn't readGEMINI_API_KEY.