# Codex extension (VS Code / Cursor)

1. First get Codex onto 2api. We recommend turning on Connect (接入) for Codex in [magpie](https://docs.2api.dev/en/magpie/). The extension uses the same settings. You can also write `~/.codex/auth.json` and `~/.codex/config.toml` by hand as described in [Codex CLI](https://docs.2api.dev/en/clients/codex/). These are the two files the extension reads.

2. Search for **Codex** in the VS Code or Cursor extension marketplace and install the official extension whose publisher is OpenAI.

3. Restart the editor and open the Codex panel. If the extension asks you to choose a sign-in method, choose the API key method. When the config files are already written, it usually goes straight in.

4. Send a message. If it replies normally, the setup is done.

:::note[The model you want isn't in the dropdown?]
The extension's model list is sometimes out of sync. This doesn't stop you from using the model. Set `model = "model-name"` in `config.toml` (replace it with the model name you looked up).
:::

:::tip[Changed the config and nothing happened?]
After you edit `config.toml`, fully quit the editor and open it again. Closing the panel doesn't reload the config.
:::