Skip to content

Feature Request: Support Gemini API Key (Google AI Studio) Authentication for Headless Environments #78

Description

@agung2001

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:

  1. 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"
  2. CLI Option:
    Add a CLI flag to explicitly pass the API key, overriding any stored OAuth credentials:

    agy --api-key "your_api_key_here" ...
  3. Fallback Mechanism:
    When invoking commands, the CLI should check for authentication in the following order of priority:

    1. Explicit --api-key flag.
    2. Environment variables (GEMINI_API_KEY / ANTIGRAVITY_API_KEY).
    3. 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.
Pinned by rodydavis

Metadata

Metadata

Labels

comp:authAuthentication, OAuth, Login Flowsfeature requestRequesting for new featuressubtype:ssh/remoteRemote SSH and headless environment issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions