1. AI application
PeakkAI-Doc
English
  • 中文
  • English
  • 首页
  • English
    • Home Page
    • PeakkAI-API
      • Model
        • Native OpenAI Format
        • Native Gemini Format
      • Chat
        • Native OpenAI Format
        • Native Gemini Format
        • Native Claude Format
        • Responses Request (openai)
      • Audio
        • Native OpenAI Format TTS
        • Native Gemini Format TTS
      • Images
        • Native OpenAI Format Image Editing (JSON)
        • Native OpenAI Format Image Generation
        • Native OpenAI Format Image Editing (Multipart)
        • Native Gemini Format Image Generation
      • Video
        • Seedance2.0 format
          • Create Video Generation Task
          • Query Video Generation Task Status
      • Vector
        • Embeddings
          • Create Embedding
      • Translation
        • Speech Translation
    • AI application
      • PeakkAI API Integration with Claude Code
      • PeakkAI API Integration with Cursor
      • PeakkAI API Integration with Codex-cli
      • PeakkAI API Integration with Codex Desktop
      • PeakkAI API Integration with Hermes Agent
  1. AI application

PeakkAI API Integration with Codex-cli

This tutorial applies to:
OpenAI Codex CLI
OpenAI Compatible API
PeakkAI API
macOS / Windows
VS Code / Terminal

I. What is Codex CLI#

1. Codex CLI#

Codex CLI is a command-line AI programming tool provided by OpenAI. It allows you to perform the following actions directly within your terminal:
Generate code
Modify projects
Analyze code repositories
Execute Shell commands
Edit files
Perform Git operations
Develop with AI assistance
常见启动方式:
或者:

Does PeakkAI API Support Codex?#

PeakkAI provides an OpenAI Compatible API, making it directly compatible with:
Codex CLI
OpenAI SDK
Cursor
Cline
Roo Code
Continue
VS Code AI 插件
OpenAI Agents SDK
You only need to replace the:
Base URL
API Key
Model
to complete the integration.

III. Prerequisites#

What You Need to Prepare#

ItemDescription
Node.jsv18+ recommended
GitOfficial Git
Codex CLIOpenAI Codex
PeakkAI API Keysk-xxxx
PeakkAI Base URLOpenAI Compatible Address

macOS Installation Guide#

1. Install Homebrew (If Not Installed)#


2. Install Node.js#


Verify Installation#


3. Install Git#


Verify Installation#


4. Install Codex CLI#

Official Installation#

image.png#

Verify Installation#

image.png
Once successfully installed, the version number will be displayed.

V. Windows Installation Guide#

1. Install Node.js#

Go to the official Node.js website to download the LTS version:
https://nodejs.org/
Recommendations:
Choose the LTS version
Check the box for "Add to PATH"

Verify Installation#

Open:
CMD
PowerShell
Windows Terminal
Run:

2. Install Git#

Download link:
Git for Windows
58f8586d-7c06-4955-bba8-6b8588725241_600x469.png
Keep the default options during installation and click Next all the way through.

Verify Installation#


3. Install Codex CLI#

image.png#

Verify Installation#

image.png
Once successfully installed, the version number will be displayed.#

VI. Get PeakkAI API Key#

Go to:
https://www.peakk.ai/
Create an API Key.

Obtain the Following Information#

Configuration ItemExample
Base URLhttps://api.peakk.ai/v1
API Keysk-xxxx
Modelgpt-5.2 / Claude-Opus-4.6 / gemini-2.5-pro

VII. Configuration via Environment Variables (Recommended Method for OpenAI)#

The Codex CLI essentially uses the OpenAI SDK under the hood, so you only need to configure your environment variables.
However, this method is only applicable to OpenAI-related models.
Supported: GPT-5.2, GPT-5.5
Unsupported: Claude Haiku 4.5, Gemini 2.5 Pro (this specific method does not support non-OpenAI models)

1. Mac / Linux Configuration#

Open your terminal:
Add the following lines:
image.png
Save the file and run:

2. Windows Configuration (Command Line Method)#

Open:
CMD
PowerShell
Windows Terminal
Run the following commands based on your terminal preference.

CMD Configuration Method#

Set API Key#

setx OPENAI_API_KEY "sk-xxxx"

Set Base URL#

setx OPENAI_BASE_URL "https://api.peakk.ai/v1"

Set Model#

setx OPENAI_MODEL "gpt-5.2"

After Configuration#

Close the current terminal window.
Reopen CMD or PowerShell.
Verify the environment variables:
echo %OPENAI_API_KEY%
echo %OPENAI_BASE_URL%
echo %OPENAI_MODEL%

VIII. Launch Codex#

Run the following command in your terminal:
If the configuration is correct, you can start using the models provided by PeakkAI directly.

IX. Verify Connection Success#

One-Click Verification#

image.png
If code is output successfully, your configuration is working properly.

X. Troubleshooting & FAQ#

1. command not found: codex#

This means the Codex CLI was not installed successfully.
Try running the installation command again:

2. Unauthorized / Invalid API Key#

Possible reasons:
Incorrect API Key
The Key has not taken effect yet
Incorrect Base URL
Check your configurations:

3. Unable to Connect to API#

Please check:
Your network connection
The Base URL format
Whether you included /v1 at the end
Correct example:
https://api.peakk.ai/v1

4. Model Does Not Exist#

This indicates that the current model name is incorrect.
Go to:
https://docs.peakk.ai/
to check the list of supported models.

XI. Using with VS Code#

Recommended setup combinations:
Codex CLI
VS Code Terminal
Git
Claude Code
Roo Code
Continue
Achieve:
AI Programming
Automated Project Modifications
Multi-model Switching
PeakkAI Aggregated Calls

修改于 2026-11-02 09:46:29
上一页
PeakkAI API Integration with Cursor
下一页
PeakkAI API Integration with Codex Desktop
Built with