Thiết lập Codex API
1. Codex API
- Hỗ trợ toàn bộ model mới nhất từ OpenAI.
- Chi phí dựa trên token từ giá gốc của OpenAI. Kiểm tra hạn mức sử dụng tại shopaipro.tech/check-usage.
- Hỗ trợ Codex ở VSCode, Codex CLI, Codex App, OpenClaw và nhiều công cụ tương thích khác.
2. Hướng dẫn setup
2.1. Codex CLI
Bước 1: Mở CMD hoặc PowerShell và chạy:
npm install -g @openai/codex
Bước 2: Sau khi hoàn tất bước 1, gõ codex. Nếu gặp lỗi, mở cửa sổ dòng lệnh mới và thử lại.
Bước 3: Chọn Provide your own API KEY.
Bước 4: Nhập key bạn đã mua và xác nhận.
Bước 5: Chọn Yes, continue, sau đó chọn Set up default sandbox.
Bước 6: Khi ô nhập prompt xuất hiện, đóng cửa sổ dòng lệnh.
Bước 7: Truy cập thư mục chứa hai file config.toml và auth.json.
Người dùng Windows: C:\Users\Người dùng\.codex\
Người dùng macOS: ~/.codex/
Bước 8: Thay toàn bộ nội dung file config.toml bằng:
model_provider = "OpenAI" model = "gpt-5.6-sol" review_model = "gpt-5.6-sol" model_reasoning_effort = "xhigh" disable_response_storage = true network_access = "enabled" windows_wsl_setup_acknowledged = true model_context_window = 1000000 model_auto_compact_token_limit = 900000 [model_providers.OpenAI] name = "OpenAI" base_url = "https://model.shopaipro.tech/v1" wire_api = "responses" requires_openai_auth = true
Bước 9: Thay nội dung file auth.json bằng:
{
"OPENAI_API_KEY": "Key của bạn mua"
}Bước 10: Mở CMD hoặc PowerShell, nhập codex để sử dụng.
2.2. Codex trong VSCode
Bước 1: Mở Extensions, tìm Codex và chọn Install.
Bước 2: Đăng nhập bằng Use API KEY.
Bước 3: Nhập key đã mua và sử dụng. Khuyến khích chọn đúng model GPT-5.6 Sol và bật mức suy luận xhigh.
Bước 4: Nếu gặp lỗi, kiểm tra lại file config.toml và auth.json theo phần hướng dẫn Codex CLI phía trên.
Cài đặt Codex CLI tự động
Windows 10/11 (PowerShell)
Mở PowerShell và chạy một lệnh:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; irm https://shopaipro.tech/install-codex.ps1 | iex
macOS
Mở Terminal và chạy:
curl -fsSL https://shopaipro.tech/install-codex.sh | sh
Linux / Ubuntu
Mở Terminal và chạy cùng một lệnh:
curl -fsSL https://shopaipro.tech/install-codex.sh | sh
Sử dụng lại sau khi cài
codex
Cài đặt OpenClaw tự động.
Windows 10/11 (PowerShell)
Mở PowerShell và chạy:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; irm https://shopaipro.tech/install-openclaw.ps1 | iex
macOS
Mở Terminal và chạy:
curl -fsSL https://shopaipro.tech/install-openclaw.sh | sh
Linux / Ubuntu
Mở Terminal và chạy cùng một lệnh:
curl -fsSL https://shopaipro.tech/install-openclaw.sh | sh
Cấu hình lại key/model, không cài lại OpenClaw
Windows PowerShell:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; irm https://shopaipro.tech/configure-openclaw.ps1 | iex
macOS / Linux:
curl -fsSL https://shopaipro.tech/configure-openclaw.sh | sh
Sau khi cài
openclaw models list --provider shopai openclaw gateway status openclaw dashboard
Cài đặt OpenClaw thủ công từng bước
Bước 1: Cài OpenClaw chính thức
Windows PowerShell:
iwr -useb https://openclaw.ai/install.ps1 | iex
macOS / Linux:
curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash
Hoặc cài bằng npm nếu máy đã có phiên bản Node.js được OpenClaw hỗ trợ:
npm install -g openclaw@latest --allow-scripts=openclaw openclaw --version
Bước 2: Lưu API key ngoài file cấu hình
Windows PowerShell:
$key = Read-Host "SHOP AI PRO API key"
[Environment]::SetEnvironmentVariable("SHOPAI_API_KEY", $key, "User")
$env:SHOPAI_API_KEY = $keymacOS / Linux: tạo file ~/.openclaw/.env, đặt quyền
SHOPAI_API_KEY=API_KEY_CUA_BAN
chmod 700 ~/.openclaw chmod 600 ~/.openclaw/.env
Bước 3: Lấy danh sách model được API key cấp quyền
Trên Windows PowerShell:
$headers = @{ Authorization = "Bearer $env:SHOPAI_API_KEY" }
$result = Invoke-RestMethod -Uri "https://contact.shopaipro.tech/api/v1/usage/models" -Headers $headers -Method Post
$result.models.idBước 4: Khởi tạo OpenClaw
openclaw onboard
Bước 5: Cấu hình SHOP AI PRO
Mở ~/.openclaw/openclaw.json.
{
"models": {
"mode": "merge",
"providers": {
"shopai": {
"baseUrl": "https://model.shopaipro.tech/v1",
"apiKey": {
"source": "env",
"provider": "default",
"id": "SHOPAI_API_KEY"
},
"api": "openai-responses",
"authHeader": true,
"models": [
{ "id": "MODEL_DA_CHON", "name": "MODEL_DA_CHON", "input": ["text"] }
]
}
}
},
"agents": {
"defaults": {
"models": {
"shopai/MODEL_DA_CHON": {}
},
"model": {
"primary": "shopai/MODEL_DA_CHON"
}
}
},
"gateway": {
"mode": "local"
}
}Bước 6: Cài Gateway chạy nền
openclaw gateway install --force openclaw gateway restart
Bước 7: Kiểm tra
openclaw models list --provider shopai openclaw gateway status openclaw dashboard