# Authentication

> Sign in to Codex locally or provide an API key to the CLI process.

Codex supports ChatGPT sign-in and API-key authentication. Start `codex` to choose an authentication method, or follow the [Codex authentication guide](https://developers.openai.com/codex/auth).

The TypeScript SDK launches the CLI and inherits its environment. Pass `env` when you need to restrict or explicitly define variables exposed to the child process. Keep credentials server-side and never commit them.
