1. AI application
AITK-Doc
English
  • 中文
  • English
  • Home Page
  • AITK-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
    • AITK API Integration with Claude Code
    • AITK API Integration with Cursor
    • AITK API Integration with Codex-cli
    • AITK API Integration with Codex Desktop
    • AITK API Integration with Hermes Agent
  1. AI application

AITK API Integration with Codex-cli

This tutorial applies to:
OpenAI Codex CLI
OpenAI Compatible API
AITK 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 can be used directly in the terminal to:
Generate code
Modify projects
Analyze code repositories
Execute Shell commands
Edit files
Perform Git operations
Assist AI development
Common startup methods:
Or:

II. Does AITK API Support Codex#

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

III. Preparation#

What You Need to Prepare#

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

IV. Mac Installation Tutorial#

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
After successful installation, the version number will be displayed.

V. Windows Installation Tutorial#

1. Install Node.js#

Go to the official Node.js website to download the LTS version:
https://nodejs.org/
Recommended:
Select LTS
Check Add to PATH

Verify Installation#

Open:
CMD
PowerShell
Windows Terminal
Run:

2. Install Git#

Download address:
Git for Windows
58f8586d-7c06-4955-bba8-6b8588725241_600x469.png
During installation, keep the default options and click Next all the way through.

Verify Installation#


3. Install Codex CLI#

image.png#

Verify Installation#

image.png
After successful installation, the version number will be displayed.#

VI. Obtain AITK API Key#

Go to:
https://www.aitk.com/
Create an API Key.

Obtain the Following Information#

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

VII. Configuration via Environment Variables (OpenAI's Recommended Integration Method)#

Codex CLI essentially uses the OpenAI SDK, so you only need to configure environment variables.
However, this method only applies to OpenAI-related models.
Valid examples: GPT-5.2, GPT-5.5
Invalid examples: Claude Haiku 4.5, Gemini 2.5 Pro — this method does not support them.

1. Mac / Linux Configuration#

Open the terminal:
Add:
After saving, run:

2. Windows Configuration (Command-Line Method)#

Open:
CMD
PowerShell
Windows Terminal
Run the following commands.

CMD Configuration Method#

Set API Key#

setx OPENAI_API_KEY "sk-xxxx"

Set Base URL#

setx OPENAI_BASE_URL "https://api.aitk.com/v1"

Set Model#

setx OPENAI_MODEL "gpt-5.2"

After Configuration#

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

VIII. Start Codex#

Run in the terminal:
If the configuration is successful, you can directly use the models provided by AITK.

IX. Test Whether the Integration Is Successful#

One-Click Verification#

image.png
If code is output normally, the configuration is successful.

X. Common Issues#

1. command not found: codex#

This indicates that Codex CLI was not installed successfully.
Run again:

2. Unauthorized / Invalid API Key#

This indicates:
Incorrect API Key
Key not yet effective
Incorrect Base URL
Check:

3. Unable to Connect to the API#

Check:
Network
Base URL
Whether /v1 is included
Correct example:
https://api.aitk.com/v1

4. Model Does Not Exist#

This indicates that the current model name is incorrect.
Go to:
https://docs.aitk.com/
to view supported models.

XI. Using with VS Code#

Recommended combinations:
Codex CLI
VS Code Terminal
Git
Claude Code
Roo Code
Continue
To achieve:
AI programming
Automatic project modification
Multi-model switching
AITK aggregated calls

修改于 2026-11-23 02:32:44
上一页
AITK API Integration with Cursor
下一页
AITK API Integration with Codex Desktop
Built with