Currently, antigravity-cli (agy) relies primarily on OAuth for user authentication. While this is seamless for interactive desktop use, it presents a significant bottleneck for automated, headless, or server-side workflows.
Specifically, in headless environments (e.g., cron jobs, CI/CD pipelines, remote staging servers). Standard OAuth-based consumer access is subject to strict daily request limits, which is highly inconvenient for power users or servers generating high-volume AI requests.
Supporting API key authentication from Google AI Studio would resolve these issues, enabling developers to run the CLI programmatically with their own API keys and custom quotas.
Proposed Solution
I propose adding support for Gemini API key authentication via:
-
Environment Variable Configuration:
The CLI should automatically detect and use a Gemini API key if present in the environment:
export GEMINI_API_KEY="your_ai_studio_api_key_here"
Or optionally a specific namespace:
export ANTIGRAVITY_API_KEY="your_api_key_here"
-
CLI Option:
Add a CLI flag to explicitly pass the API key, overriding any stored OAuth credentials:
agy --api-key "your_api_key_here" ...
-
Fallback Mechanism:
When invoking commands, the CLI should check for authentication in the following order of priority:
- Explicit
--api-key flag.
- Environment variables (
GEMINI_API_KEY / ANTIGRAVITY_API_KEY).
- Existing OAuth credentials stored locally.
Additional Context
- This is particularly impactful for workflows like running daily or weekly automated codebase review scripts using
agy --dangerously-skip-permissions under system crontabs.
- Using a direct Gemini API key allows the CLI to run immediately without interactive prompt steps, which is perfect for non-interactive scripts.
Currently,
antigravity-cli(agy) relies primarily on OAuth for user authentication. While this is seamless for interactive desktop use, it presents a significant bottleneck for automated, headless, or server-side workflows.Specifically, in headless environments (e.g., cron jobs, CI/CD pipelines, remote staging servers). Standard OAuth-based consumer access is subject to strict daily request limits, which is highly inconvenient for power users or servers generating high-volume AI requests.
Supporting API key authentication from Google AI Studio would resolve these issues, enabling developers to run the CLI programmatically with their own API keys and custom quotas.
Proposed Solution
I propose adding support for Gemini API key authentication via:
Environment Variable Configuration:
The CLI should automatically detect and use a Gemini API key if present in the environment:
Or optionally a specific namespace:
CLI Option:
Add a CLI flag to explicitly pass the API key, overriding any stored OAuth credentials:
agy --api-key "your_api_key_here" ...Fallback Mechanism:
When invoking commands, the CLI should check for authentication in the following order of priority:
--api-keyflag.GEMINI_API_KEY/ANTIGRAVITY_API_KEY).Additional Context
agy --dangerously-skip-permissionsunder system crontabs.The current pay as you go option is supported by adding a GCP project id to Antigravity 2.0 or the CLI.
https://antigravity.google/docs/enterprise
Gemini API Key is not supported currently. We are reviewing the feedback from the community but do not have any updates at this time.
For using an API key in Antigravity you can use the SDK.
https://antigravity.google/docs/sdk/overview
The SDK should fit a lot of the use cases that you need for CI workflows.