Skip to main content

Direct answer

The VS Code Codex extension has no separate Base URL or API Key fields. It shares configuration layers with Codex CLI. Click the gear icon, choose Codex Settings → Open config.toml, and add the BetterToken provider to your user config. Then run Developer: Reload Window so the extension reads the new endpoint, Key, and model.
It is normal if you do not see Base URL or API Key fields in VS Code settings. Do not put the custom endpoint in the general VS Code proxy settings.

Prerequisites

  • VS Code is installed
  • The Codex - OpenAI’s coding agent extension is installed
  • You have a BetterToken API Key (sign up and get one)
  • You have copied an available model ID from the GPT Key group in the model plaza
Do not put your API Key in project files, AGENTS.md, sample .env files, or public repositories. The configuration below should stay in your local Codex configuration directory.

Setup methods

After you create an API Key, the console opens a Setup dialog. From that dialog, copy API Key and Base URL, then choose a Codex setup method.
1

Select Codex

Select Codex under Available tools.
2

Choose a setup method

You can choose:
  • One-click Bash Configuration: copy the command and run it in your local terminal. Use this for quick setup.
  • CC Switch Integration: import the provider into CC Switch. Use this when you manage multiple tools.
  • Manual Configuration: copy API Key and Base URL, then write them into config.toml.
3

Restart VS Code

After the configuration is written, restart VS Code or run Developer: Reload Window so the Codex extension reads the local configuration again.

Why keep the official login state?

The VS Code Codex extension depends on Codex app-side capabilities such as the extension UI, session management, and VS Code integration. Keep the official login state while routing model requests through BetterToken. In this configuration:
The official Codex config reference recommends env_key for ordinary custom-provider API Keys. This page uses experimental_bearer_token because this scenario also preserves the official Codex login. If you only use Codex CLI and do not need plugins, Remote Control, or the official login state, use the ordinary custom-provider config.toml setup.

Verify which config the extension reads

After setup, open the Codex extension in VS Code and send a short test message. If you get a normal response, the configuration is active. You can also open config.toml from the extension gear again and confirm it is the file you edited.

Common errors

References