LLM API

Codex CLI

Integrate ARZASTORE AI API with Codex CLI — OpenAI's AI coding assistant in the terminal

What is Codex CLI?

System Requirements

Operating System

  • macOS / Linux (Terminal with Bash/Zsh)
  • Windows (PowerShell / Git Bash)

Software

  • Node.js version 22 or later
  • npm (bundled with Node.js)

Account

  • ARZASTORE AI account with sufficient balance
  • Consumer API Key (sk-xxx)
  • Subscribed to an OpenAI model (GPT-4.1, o4-mini, o3, ...)

Install Codex CLI

Install Codex CLI using npm:

npm install -g @openai/codex

Verify the installation:

codex --version

Update version

Quickstart via API Keys (Recommended)

Similar to the Claude Code flow, you can complete the setup in minutes directly from the API Keys page without manual configuration.

  1. 01Go to Console → API Keys, select the API Key you want to use
  2. 02Switch to the Codex CLI tab
  3. 03Select your OS, default model, then copy the setup command
  4. 04Paste the command into terminal, restart terminal, then run codex
  5. 05If there are errors, quickly check the Troubleshooting section below

First Run

# Mở Codex CLI trong thư mục dự án
cd /path/to/your/project
codex
# Chạy với câu lệnh cụ thể
codex "Giải thích cấu trúc của dự án này"

Manual Configuration

If not using auto setup, configure the 2 environment variables below.

Environment Variables

VariableValueDescription
OPENAI_API_KEYsk-your-api-keyConsumer API Key from ARZASTORE AI
OPENAI_BASE_URLhttps://api.arzastore.com/v1Endpoint URL from Marketplace
# Thêm vào ~/.bashrc hoặc ~/.zshrc
export OPENAI_API_KEY="sk-your-arzastore-api-key"
export OPENAI_BASE_URL="https://api.arzastore.com/v1"
# Reload shell
source ~/.bashrc # hoặc source ~/.zshrc
# Thiết lập vĩnh viễn (cho user hiện tại)
[System.Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-your-arzastore-api-key", "User")
[System.Environment]::SetEnvironmentVariable("OPENAI_BASE_URL", "https://api.arzastore.com/v1", "User")
# Restart terminal để áp dụng

Select Model

Codex CLI supports OpenAI models. You need to subscribe to the corresponding model on Marketplace and call the exact model ID or alias.

ModelModel IDFeaturesBest for
o4-minio4-miniFast, low costSimple tasks, autocomplete
GPT-4.1gpt-4.1Balanced speed/qualityCoding, debug, refactor
o3o3Strong reasoningComplex analysis
# Chạy với model mặc định
codex
# Chạy với model cụ thể
codex --model gpt-4.1
# Chạy với prompt trực tiếp
codex --model o4-mini "Giải thích cấu trúc dự án này"

Use aliases for easy management

Useful Commands

Display the list of available options and commands.

Change the model for the current session.

Run with fewer confirmation steps for simple tasks.

Troubleshooting

Error "API key not valid"

  • • Check that OPENAI_API_KEY is set correctly
  • • Check that the key has not been revoked
  • • Check that the account balance is sufficient

Error "Connection refused" / timeout

  • • Check that OPENAI_BASE_URL is correct and includes /v1
  • • Check network connection

Error "Model not found"

  • • Check that the model is subscribed on Marketplace
  • • Check that the model ID/alias is correct

Quick debug

# Kiểm tra biến môi trường (an toàn)
[ -n "$OPENAI_API_KEY" ] && echo "OPENAI_API_KEY is set" || echo "OPENAI_API_KEY is missing"
[ -n "$OPENAI_BASE_URL" ] && echo "$OPENAI_BASE_URL" || echo "OPENAI_BASE_URL is missing"
# Test endpoint nhanh (chỉ chạy khi đã cấu hình đủ biến)
if [ -n "$OPENAI_API_KEY" ] && [ -n "$OPENAI_BASE_URL" ]; then
 curl -s "$OPENAI_BASE_URL/models" -H "Authorization: Bearer $OPENAI_API_KEY" | head -c 200
fi

Need more help?

Our support team is ready to assist you

$

Prices are shown in USD

Picked from your location (Chile). You can change it anytime from the language button in the top bar, or pick one below.