Connect Antigravity to TeamoRouter: Call Gemini Models with a TeamoRouter API Key
Antigravity is Google's AI coding tool. Its command-line version (the agy command) lets you change the Gemini endpoint, so with a TeamoRouter API key it calls Gemini models on TeamoRouter directly.
The Antigravity desktop apps (Antigravity and Antigravity IDE) require a Google sign-in on launch and have no field for an API key or endpoint, so they cannot connect to TeamoRouter today. The steps below are for the agy CLI only.
1. Install the Antigravity CLI (agy)
On macOS and Linux, run the official installer:
curl -fsSL https://antigravity.google/cli/install.sh | bash
It installs agy into ~/.local/bin. Run agy --version to check it worked. For Windows, see the official Antigravity install guide.
2. Get a TeamoRouter API key
Sign up in the TeamoRouter dashboard and create an API key (it looks like sk-teamo-...).
3. Connect to TeamoRouter
First, switch agy to API-key mode for Gemini by writing ~/.gemini/antigravity-cli/settings.json:
mkdir -p ~/.gemini/antigravity-cli && cat > ~/.gemini/antigravity-cli/settings.json <<'EOF'
{
"modelProvider": "gemini"
}
EOF
Then set the TeamoRouter endpoint and your key (replace <your-TeamoRouter-key>):
export GOOGLE_GEMINI_BASE_URL=https://api.teamorouter.com
export GEMINI_API_KEY=sk-teamo-<your-TeamoRouter-key>
Use the bare domain, without /v1beta. Add both lines to ~/.zshrc or ~/.bashrc to keep them in every new terminal.
4. Check the connection
List the available models. Seeing the Gemini 4 family means you are on TeamoRouter:
agy models
Then send a prompt:
agy --model gemini-4-neon -p "Hello"
From then on, run agy in any project folder. Swap --model for gemini-4-hydrogen, gemini-4-carbon, gemini-4-argon, gemini-3.8-flash and others.
FAQ
Can I only use Gemini models?
Yes. With a custom endpoint agy speaks the Gemini protocol, so only Gemini models work. For Claude or GPT, use Claude Code or Codex.
Getting 401 invalid_api_key?
Check that GEMINI_API_KEY is complete and was set in the same terminal. New terminals need the export again unless you added it to ~/.zshrc.
agy still asks for a Google sign-in?
Make sure "modelProvider": "gemini" is saved in ~/.gemini/antigravity-cli/settings.json. The environment variables alone do not switch agy to API-key mode.