[Zero Basis Tutorial] Configure Codex and Use NodeLoc Ai (Terminal+VSCode)

Install Node.js

Use the official installer (recommended)

  1. Visit https://nodejs.org
  2. Download the LTS version Windows Installer (.msi)
  3. Run the installer and complete the installation with the default settings
  4. The installer will automatically add it to the PATH environment variable

Verify the installation:

# Open Command Prompt or PowerShell and run the following commands
node --version

npm --version

Install CodeX CLI

Open Command Prompt (run as administrator) or PowerShell and execute the following commands:

# Install CodeX globally
npm install -g @openai/codex@latest

# Verify installation
codex --version

Configure Nodeloc API

Obtain a NodeLoc API Token:
Visit https://ai.nodeloc.com

  • Click Console → API Tokens page
  • Click Add Token
  • For token group, select codex exclusive (must choose this group, otherwise it will not work)
  • Token name can be anything
  • Suggested quota: set to unlimited for personal use
  • Keep other options at default

System environment variable

Set a system environment variable named NODE_LOC_TOKEN with the value you just obtained

Create configuration files

# Create CodeX configuration directory
mkdir %USERPROFILE%\.codex
cd %USERPROFILE%\.codex

After creation the path will be C:\Users\YourUsername\.codex

Create configuration files:

  1. Create a config.toml file

Location: ~/.codex/config.toml

Use Notepad or any text editor you prefer to create the config.toml file:

model = "gpt-4.1"
model_provider = "openai-chat-completions"
preferred_auth_method = "apikey"

[model_providers.openai-chat-completions]
name = "OpenAI using Chat Completions"
base_url = "https://ai.nodeloc.com/v1"
env_key = "NODE_LOC_TOKEN"
wire_api = "chat"
query_params = {}
stream_idle_timeout_ms = 300000
  1. Create an auth.json file

Location: ~/.codex/auth.json

Create the auth.json file in the same directory:

{
"OPENAI_API_KEY": "Paste token key (sk-xxxxxxx)"
}

Terminal test

# Create a new project
mkdir my-codex-project
cd my-codex-project

# Start CodeX
codex

VSCode configuration – Visual Studio Code setup for all platformsCursor, etc. can also be used)

Configuration steps

Note: Make sure you have installed the ChatGPT/CodeX related VSCode extension(s)


Open VSCode’s settings.json file and add the following configuration:

    "chatgpt.apiBase": "https://ai.nodeloc.com/v1",
    "chatgpt.config": {
        "pepreferred_auth_method": "api_key",
        "model_provider": "openai-chat-completions"
    }

Restart VSCode to apply the changes

About

16 Likes

感谢大佬分享 :+1:

谢谢爱心分享,学习一下!

感謝您的無私分享~點讚~

感谢分享,又学习了。

感谢分享

Really comprehensive, thanks :xhj003:

1 Like

Embrace AI, a great tutorial. :xhj16:

So detailed!

1 Like

Thank you, senior, for the detailed configuration tutorial.

Not bad, but the limit is a bit low.

Study

Share, thank you

Learn and understand

Good stuff, thanks for sharing.Creating new file

The tutorial is very detailed

Thanks for sharing, boss :+1:

Come take a look.

Study

Thank you for sharing