VSCode Extension with API Key

Here are the steps I took to get Codex extension working in VSCode:

  1. Quit VSCode.

  2. Edit the file ~/.codex/config.toml to include the following:

preferred_auth_method = "apikey"
  1. Open the file ~.codex/auth.json and delete all the contents. Save.
  2. In terminal export your OpenAI key:

% export OPENAI_API_KEY="your-api-key-here"

  1. Start VSCode:

% code .

  1. Install the Codex extension. And login using “Use API Key”: