Authentication and environment
Configure ChatGPT or API-key authentication for the local Codex process.
Codex CLI authentication is local to the process. Run codex and sign in with ChatGPT, or configure API-key authentication using the OpenAI Codex authentication guide.
The TypeScript SDK inherits the parent process environment by default. Pass env to control what the child CLI receives:
Never commit API keys or pass them to untrusted workspaces. For MCP servers, configure each server's credentials in the Codex configuration or use codex mcp login for OAuth-capable servers.
Actualizado el 31 ago 2026