Setup and configure Codex CLI for AI-assisted coding using Nebius Token Factory models over an OpenAI-compatible API.
# 1. Install Codex CLI
npm install -g @openai/codex
# 2. Download and run the setup script
curl -fsSL https://raw.githubusercontent.com/opencolin/codex-nebius/main/setup-codex-nebius.sh -o setup-codex-nebius.sh
chmod +x setup-codex-nebius.sh
bash setup-codex-nebius.sh
# 3. Start coding
codex "Write a Python function to validate email addresses"Tip: Download the script first instead of piping directly to avoid corruption issues.
🔄 Flexible — Switch models instantly via configuration
🚀 Fast Setup — Automated configuration script
📦 Three Profiles — Fast, balanced, and precise models
🎯 Unified CLI — One interface for multiple LLM providers
-
setup-codex-nebius.sh — Automated setup script
- Checks dependencies
- Creates
~/.codexconfiguration - Prompts for API key securely
- Tests connection to Token Factory
- Generates pre-configured profiles
-
CODEX_CLI_SETUP_GUIDE.md — Complete setup guide
- Manual configuration steps
- Advanced profile customization
- Integration with editors (VSCode, Neovim)
- Git workflow integration
- Troubleshooting & security best practices
- Codex CLI — Install with
npm install -g @openai/codex - Nebius Token Factory API key — Get from https://nebius.com/
- bash or zsh — For the setup script
# Using default profile (balanced)
codex "Write a Python function"
# Using fast profile
codex --profile nebius-fast "Quick implementation"
# Using precise profile
codex --profile nebius-precise "Detailed explanation"# Change temperature for more/less creative output
codex -c temperature=0.3 "Be precise"
# Limit response length
codex -c max_tokens=1024 "Short answer"| Profile | Model | Use Case | Speed |
|---|---|---|---|
| nebius-token-factory (default) | Hermes-4-405B | Balanced, all-purpose | Medium |
| nebius-fast | Gemma-3-27b | Quick suggestions and completions | Fast |
| nebius-precise | Qwen3-Coder-480B | Complex coding and analysis | Slow |
After running the setup script, configuration is stored in ~/.codex/config.toml.
All three profiles share a single nebius_token_factory provider:
default_provider = "nebius_token_factory"
default_profile = "nebius-token-factory"
[model_providers.nebius_token_factory]
name = "Nebius Token Factory"
base_url = "https://api.tokenfactory.nebius.com/v1"
env_key = "NEBIUS_API_KEY"
wire_api = "responses"
# Balanced (default)
[profiles.nebius-token-factory]
model_provider = "nebius_token_factory"
model_name = "nebius/NousResearch/Hermes-4-405B"
max_tokens = 4096
temperature = 0.7
# Fast
[profiles.nebius-fast]
model_provider = "nebius_token_factory"
model_name = "nebius/google/Gemma-3-27b-it"
max_tokens = 2048
temperature = 0.5
# Precise
[profiles.nebius-precise]
model_provider = "nebius_token_factory"
model_name = "nebius/Qwen/Qwen3-Coder-480B-A35B-Instruct"
max_tokens = 8192
temperature = 0.3See CODEX_CLI_SETUP_GUIDE.md for detailed configuration options.
v2.0 is a breaking release: the redundant nebius_fast provider was removed and
all three profiles now reference the single nebius_token_factory provider. If you
have an existing ~/.codex/config.toml from a 1.x setup, just re-run the setup
script — it backs up your old config to config.toml.bak.<timestamp> before writing
the new layout. See the Migration notes in the CHANGELOG
for details.
This error occurs when the setup script is corrupted during download via pipe.
Solution: Download the script first, then run it:
curl -fsSL https://raw.githubusercontent.com/opencolin/codex-nebius/main/setup-codex-nebius.sh -o setup-codex-nebius.sh
chmod +x setup-codex-nebius.sh
bash setup-codex-nebius.shOr clone the repository:
git clone https://github.com/opencolin/codex-nebius.git
cd codex-nebius
bash setup-codex-nebius.shnpm install -g @openai/codexVerify your Nebius API key:
echo $NEBIUS_API_KEYReload your shell profile if you just set it:
source ~/.zshrc # or ~/.bashrcCheck connectivity to Token Factory:
curl -H "Authorization: Bearer $NEBIUS_API_KEY" \
https://api.tokenfactory.nebius.com/v1/modelsFor more troubleshooting, see CODEX_CLI_SETUP_GUIDE.md.
- Codex CLI GitHub — Official Codex CLI repository
- Nebius Documentation — Official Nebius docs
- Nebius Token Factory — Token Factory service
- Codex Provider Configuration — Provider setup guide
MIT
Found an issue or have suggestions? Please open an issue or submit a PR!
Part of the codex-nebius project — AI Skills for Nebius infrastructure