amika CLI authenticates to the
hosted platform. For a task-oriented walkthrough, see the
Manage secrets guide.
The TypeScript SDK does not use any of the stored credentials below. It
requires you to pass an
apiKey, an accessToken, or a tokenSource. See
Token sources. The HTTP API takes an API key
as a bearer token. See the HTTP API overview.Login modes
amika auth login has two modes:
- Browser login: interactive device authorization flow. Best for local development.
- API key login: non-interactive, for CI and automation.
Browser login
The defaultamika auth login authenticates with Amika using a device
authorization flow.
How it works
- The CLI requests a device code from Amika.
- A user code is displayed and the browser opens for you to authorize.
- The CLI polls Amika until you complete authorization.
- The session (access token, refresh token, email, org) is saved to
${XDG_STATE_HOME}/amika/workos-session.json. - Access tokens are automatically refreshed when within 60 seconds of expiry.
API key login
Use an Amika API key when you need to authenticate without a browser, for example from CI jobs or automated scripts.Create a key
Generate API keys in the web UI at app.amika.dev/settings/api-keys in the API Keys section. Or create one from the CLI withamika auth api-key create. It
writes the key to a file and never prints it. This command ships in the next
CLI release, so use the web UI until then.
--scope user for a key
that acts as you.
Use the key
Environment variable (highest priority):AMIKA_API_KEY is set, it overrides any stored API key or browser
session. Good for ephemeral CI runs.
Store on disk with amika auth login --api-key-file:
${XDG_STATE_HOME}/amika/api-key.json with 0600
permissions.
Credential precedence
When multiple credentials are present,amika picks the first one that is
set, in this order:
AMIKA_API_KEYenvironment variable- Stored API key file (
${XDG_STATE_HOME}/amika/api-key.json) - Browser login session (
${XDG_STATE_HOME}/amika/workos-session.json)
amika auth status prints the active source and warns if a lower-priority
credential is being shadowed. amika auth logout clears both the stored API
key and the browser session.
Local credential discovery
amika secret extract discovers API credentials that coding agent tools store
on your machine, shows them masked, and with --push uploads them to the Amika
secrets store. See Manage secrets.
Supported sources
Amika reads sources in priority order. Higher-priority sources win when multiple files provide the same provider key.Secret names
Amika normalizes provider names and uses common aliases as secret names:- Anthropic keys become both
ANTHROPIC_API_KEYandCLAUDE_API_KEY. - OpenAI keys become both
OPENAI_API_KEYandCODEX_API_KEY.
claude and
anthropic become anthropic, codex and openai become openai, and other
providers are lowercased with separators normalized to hyphens. OAuth tokens
with an expiresAt or expires timestamp are skipped if expired.
secret extract flags
Environment variables
Related docs
- Manage secrets: push and inject credentials
- Secrets reference: scope model and provider secrets
- Storage paths: where sessions and caches live