Skip to content

Using New API with Codex

Install Codex

bash
pnpm install -g @openai/codex
bash
npm install -g @openai/codex
bash
yarn global add @openai/codex

Configure Environment Variables

  1. Visit https://model.imkk.us/console/token to get your API Key
  2. Set system environment variable, variable name NEW_API_TOKEN, value is the value you just applied for (Environment Variable Setup Tutorial)
  3. Create ~/.codex/config.toml file and add the following configuration
toml
model = "gpt-5"
model_provider = "openai-chat-completions"
preferred_auth_method = "apikey"


[model_providers.openai-chat-completions]
name = "OpenAI using Chat Completions"
base_url = "https://model.imkk.us/v1"
env_key = "NEW_API_TOKEN"
wire_api = "chat"
query_params = {}
stream_idle_timeout_ms = 300000
  1. Create ~/.codex/auth.json file and add the following code
json
{
 "OPENAI_API_KEY":"Replace here with your applied KEY"
}

Direct Launch and Use

After configuring the environment variables, use the terminal to open the project directory you want to work with, then run the following command to start Codex:

bash
# Enter the project directory
cd my-project

# Directly start OpenAI Codex
codex

Using in VSCode with Codex

  1. Refer to the above instructions to install Codex and configure environment variables and configuration files.

  2. Open VSCode and install the Codex Extension.

  3. Go to settings and click the top right corner to switch to JSON configuration mode

  1. Add the following configuration items
json
"chatgpt.apiBase": "https://model.imkk.us/v1",
"chatgpt.config": {
    "pepreferred_auth_method": "api_key",
    "model_provider": "openai-chat-completions"
}

  1. Click the Codex icon to start using