If you want to use Codex in the terminal or the VSCode extension and route model requests through Nbility, follow the steps below.
Install Codex
Choose one installation method:
pnpm install -g @openai/codex
npm install -g @openai/codex
yarn global add @openai/codex
bunx --global @openai/codex
Prepare Credentials
Before you start, confirm that:
- You have an active Nbility account
- You have created a token in the console
- The token is still valid and has enough balance
You can get the token from the /console/token page. If you have not completed this step yet, read Getting Started or the Beginner's Guide first.
Configure Codex CLI
First create ~/.codex/config.toml and add content similar to this:
model = "gpt-5.3-codex"
model_provider = "nbility"
preferred_auth_method = "apikey"
[model_providers.nbility]
name = "OpenAI using Chat Completions"
base_url = "https://api.nbility.dev/v1"
wire_api = "responses"
query_params = {}
stream_idle_timeout_ms = 300000
Then create ~/.codex/auth.json and replace the key with your own token:
{
"OPENAI_API_KEY": "your_api_key_here"
}
Start Codex
Enter any project directory and run:
cd my-project
codex
If the interactive UI opens and the model call succeeds, the CLI setup is complete.
Use Codex in VSCode
If you also installed the Codex VSCode extension, you can reuse the same Nbility endpoint.
The general flow is:
- Install the Codex extension
- Open VSCode settings and switch to JSON editing mode
- Add the Base URL and authentication settings required by the extension
Example settings:
{
"chatgpt.apiBase": "https://api.nbility.dev/v1",
"chatgpt.config": {
"preferred_auth_method": "api_key",
"model_provider": "nbility"
}
}
After saving, open the extension, choose a model, and start using it.
Tips
- Create a separate token for Codex so usage is easier to track
- If you mainly use GPT models, start with the default configuration before adding many models
- If both CLI and VSCode use the same endpoint, verify the CLI first, then configure the editor