API key

A secret string that identifies your account to an AI provider's API, billed per token rather than by subscription.

Updated November 23, 2026

Agents read API keys from environment variables (ANTHROPIC_API_KEY, CODEX_API_KEY, GEMINI_API_KEY and others) or from their own login command. The variable name matters: Codex 0.157.1 ignores OPENAI_API_KEY and answers “Missing bearer or basic authentication in header”.

Keep keys out of repositories and out of shared machines, and prefer a subscription login where the agent supports one. In an EnvHaven workspace, the Vars pane and the Launch menu’s Set key store keys write-only and export them into every new shell, where the agents pick them up.