Skip to main content
The CLI authenticates with a GC AI API key. See API keys for the difference between personal and organization keys.

Logging in

This prints a prompt, opens Settings → API in your browser, and waits for you to paste a key. It verifies the key with a ping before saving it. Account creation is browser-only; gcai auth signup opens the sign-up page. Related commands:

Where credentials live

gcai auth login stores your key and base URL in ~/.config/gcai/config.json (or $XDG_CONFIG_HOME/gcai/config.json), created with owner-only permissions. Storing the base URL alongside the key means a key minted against a non-production environment keeps hitting the right server without re-passing --base-url.

Choosing a key without logging in

You can skip the stored login for a single command with a flag or an environment variable. Each command resolves its key and base URL in this order:
  1. --api-key / --base-url flags
  2. GCAI_API_KEY / GCAI_BASE_URL environment variables
  3. the stored login (gcai auth login)
  4. the default base URL (https://app.gc.ai/api/external/v1)
This makes the CLI convenient in CI: set GCAI_API_KEY as a secret and skip auth login entirely.