Antigravity CLI
Antigravity CLI (agy) is Google's terminal coding agent. It connects to MAG through the Gemini API route.
Coding agents make many model calls with long contexts. Usage can be expensive and counts against the allocation of your project. Frontier models cost more per token. To reduce cost, use a smaller model for routine tasks and a lower reasoning effort. Check your spend on the MAG Dashboard.
1. Configure Antigravity CLI
Make sure the environment variable AMSC_TOKEN contains your PAT, as shown in Step 4.
Choose one option. Option A sends every agy session to MAG. Option B adds a separate command, agy-amsc, and keeps agy signed in with your Google account.
Option A: Use MAG for every session
Antigravity CLI reads the API key and the endpoint from two environment variables. Add this to ~/.zshrc or ~/.bashrc:
export GEMINI_API_KEY="$AMSC_TOKEN"
export GOOGLE_GEMINI_BASE_URL="https://mag.genesis.americansciencecloud.org"
Do not add /v1 to the base URL. Antigravity CLI sends its requests to /v1beta. It sends the key in the header X-Goog-Api-Key, and MAG accepts the PAT in that header.
The environment variables alone are not enough. Antigravity CLI uses them only when modelProvider is set to gemini in ~/.gemini/antigravity-cli/settings.json:
{
"modelProvider": "gemini"
}
Without this setting, Antigravity CLI signs in with your Google account and sends requests to Google, not to MAG. When MAG is in use, the banner shows Gemini API key instead of an account email.
Option B: Use a shell function
Add the following to ~/.zshrc or ~/.bashrc:
agy-amsc() {
local alt="$HOME/.agy-amsc"
local settings="$alt/.gemini/antigravity-cli/settings.json"
local f name
mkdir -p "$alt/.gemini/antigravity-cli" || return 1
# Link the rest of your home directory, so that tools such as git and ssh keep their settings
for f in "$HOME"/.[!.]* "$HOME"/*; do
[ -e "$f" ] || continue
name="${f##*/}"
case "$name" in .gemini|.agy-amsc) continue ;; esac
[ -e "$alt/$name" ] || [ -L "$alt/$name" ] || ln -s "$f" "$alt/$name"
done
[ -e "$alt/.gemini/config" ] || [ -L "$alt/.gemini/config" ] \
|| ln -s "$HOME/.gemini/config" "$alt/.gemini/config"
[ -e "$settings" ] || cat > "$settings" <<'JSON'
{
"modelProvider": "gemini",
"customModelsConfig": {
"customModels": {
"gemini-4-argon": {
"modelId": "gemini-4-argon",
"modelName": "gemini-api://gemini-4-argon",
"label": "Gemini 4 Argon",
"apiProvider": "API_PROVIDER_GOOGLE_GEMINI",
"maxTokens": 1048576,
"modelFeatures": {
"supportsImages": true,
"supportsPdf": true,
"supportsToolCalls": true,
"zeroShotCapable": true
}
}
}
}
}
JSON
# Use Gemini 4 Argon at medium effort unless you select a model or an effort
local defaults=()
if [ $# -eq 0 ] || [ "${1#-}" != "$1" ]; then
case " $* " in
*" --model "*|*" --model="*) ;;
*) defaults+=(--model gemini-4-argon) ;;
esac
case " $* " in
*" --effort "*|*" --effort="*) ;;
*" --model "*|*" --model="*)
case " $* " in *gemini-4-argon*) defaults+=(--effort medium) ;; esac ;;
*) defaults+=(--effort medium) ;;
esac
fi
HOME="$alt" \
GEMINI_API_KEY="$AMSC_TOKEN" \
GOOGLE_GEMINI_BASE_URL="https://mag.genesis.americansciencecloud.org" \
command agy "${defaults[@]}" "$@"
}
Antigravity CLI cannot read its settings from another directory, so the function runs it with HOME set to ~/.agy-amsc. That directory holds the settings for MAG and links to the other files in your home directory. Your settings in ~/.gemini/config are shared, but agy-amsc keeps its own conversation history.
agy-amsc accepts the same options as agy. Without --model and --effort, it uses Gemini 4 Argon at medium effort. To check that agy-amsc uses MAG, look for Gemini API key in the banner.
2. Start Antigravity CLI
Start it in your project directory. If you chose Option B, run agy-amsc instead of agy:
cd my-project
agy
To run one prompt and print the answer, use -p:
agy -p "Explain what this repository does."
If the command agy is not found, add the install directory to your path:
export PATH="$HOME/.local/bin:$PATH"
3. Select a model
Antigravity CLI offers its built-in models and any custom models defined in settings.json. To list the built-in models, run:
agy models
Without --model, Antigravity CLI uses Gemini 3.1 Pro (Low). To select a model and a reasoning effort for one session, use the options --model and --effort:
agy --model "Gemini 3.8 Flash (Low)"
Gemini 4 Argon
Gemini 4 Argon is not in the built-in list. The agy-amsc function from Option B already adds it. With Option A, add it as a custom model in ~/.gemini/antigravity-cli/settings.json:
{
"modelProvider": "gemini",
"customModelsConfig": {
"customModels": {
"gemini-4-argon": {
"modelId": "gemini-4-argon",
"modelName": "gemini-api://gemini-4-argon",
"label": "Gemini 4 Argon",
"apiProvider": "API_PROVIDER_GOOGLE_GEMINI",
"maxTokens": 1048576,
"modelFeatures": {
"supportsImages": true,
"supportsPdf": true,
"supportsToolCalls": true,
"zeroShotCapable": true
}
}
}
}
}
Always pass --effort with this model:
agy --model gemini-4-argon --effort medium
Without --effort, the request fails with Thinking budget is not supported for this model.
Antigravity CLI also makes a small background request with a lightweight model on every run. MAG serves it without any setting from you.