Codex
Codex is an AI programming assistant tool based on the OpenAI API.
With this tutorial, you can easily install and use Codex on your own computer.
MoArk provides native support for Codex.
You can use any of MoArk’s coding models to enjoy better Chinese support and lower call costs.
We recommend starting with the Codex desktop app (GUI). The GUI is better suited for everyday use: install it, choose a project, and start chatting.
1. Install Codex
You can install the Codex CLI using your preferred package manager:
Install via npm (Recommended)
npm install -g @openai/codex
Install via Homebrew (macOS)
brew install codex
Verify Installation
After installation, open your terminal and run the following command:
codex --version
If the version number is displayed, the installation was successful!
2. Obtain Access Token
Developers first need to visit Workbench -> Settings -> Access Tokens to obtain an access token.
Developers who have not purchased the Serverless API can use a free trial access token (for testing purposes only, with limited daily calls).
Simply copy the token you wish to use.

3. Configure Codex
To connect Codex to MoArk’s service, you need to set up configuration files and environment variables.
Configuration File Setup
Add the following configuration to the file ~/.codex/config.toml:
model_provider = "moark"
model = "GLM-4_5"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.moark]
name = "moark"
base_url = "https://api.moark.ai/v1"
wire_api = "chat"
requires_openai_auth = true
env_key = "GITEE_AI_KEY"
Configure your API key in the file ~/.codex/auth.json:
{
"OPENAI_API_KEY": null
}
Set OPENAI_API_KEY to null, and then set the environment variable GITEE_AI_KEY to your API key.
4. Configure Environment Variables
Windows (PowerShell)
Temporary Setting (Current Session)
$env:GITEE_AI_KEY = "your_API_key"