
This guide will walk you through integrating OpenAI Codex CLI with APIpie, enabling advanced AI-powered coding, automation, and reasoning directly from your terminal.
Codex CLI is a lightweight, open-source coding agent that runs in your terminal. It brings ChatGPT-level reasoning and automation to your development workflow, allowing you to:
By connecting Codex CLI to APIpie, you unlock access to a wide range of powerful models, enhanced context windows, and cost-efficient AI capabilities.
Install globally via npm:
npm install -g @openai/codex
Or with yarn:
yarn global add @openai/codex
Set your APIpie endpoint and API key as environment variables:
export APIPIE_BASE_URL="https://apipie.ai/v1"
export APIPIE_API_KEY="your-APIpie-key-here"
~/.zshrc, ~/.bashrc) for persistence.You can now run Codex CLI with APIpie: ( you only need to use the flag "--provider APIPIE" to change codex across to APIPIE as a provider )
codex --provider APIPIE
Or with a prompt:
codex --provider APIPIE "explain this codebase to me"
Codex CLI supports a config file at ~/.codex/config.yaml where you can configure APIpie as your provider:
model: gpt-4o-mini # or any supported APIpie model
provider: APIPIE
providers:
APIPIE:
name: 'APIpie'
baseURL: 'https://apipie.ai/v1'
envKey: 'APIPIE_API_KEY'
fullAutoErrorMode: ask-user
Alternatively, you can use JSON format at ~/.codex/config.json:
{
"model": "gpt-4o-mini",
"provider": "APIPIE",
"providers": {
"APIPIE": {
"name": "APIpie",
"baseURL": "https://apipie.ai/v1",
"envKey": "APIPIE_API_KEY"
}
},
"fullAutoErrorMode": "ask-user"
}
You can also add custom instructions in ~/.codex/instructions.md or use the new-style project docs in ~/.codex/AGENTS.md.

--approval-mode full-auto for hands-free automation (sandboxed and safe).| What you type | What happens |
|---|---|
codex "Refactor the Dashboard component to React Hooks" | Codex rewrites the component, runs tests, and shows the diff. |
codex "Generate SQL migrations for adding a users table" | Creates migration files and runs them in a sandboxed DB. |
codex "Write unit tests for utils/date.ts" | Generates and runs tests, iterating until they pass. |
codex "Bulk-rename *.jpeg → *.jpg with git mv" | Safely renames files and updates usages. |
codex "Explain what this regex does: ^(?=.*[A-Z]).{8,}$" | Outputs a step-by-step human explanation. |
codex "Carefully review this repo, and propose 3 high impact PRs" | Suggests impactful PRs in the current codebase. |
codex "Look for vulnerabilities and create a security review report" | Finds and explains security bugs. |
Codex CLI lets you control agent autonomy via the --approval-mode flag:
All actions are sandboxed and network-disabled for safety.
export lines to your shell profile.For more, see the Codex CLI GitHub.
If you encounter any issues during the integration process, please reach out on APIpie Discord for assistance.
Integrate ANSE with APIpie: Step-by-Step Setup Guide
Integrate ANSE with APIpie effortlessly! Follow our guide to set up API keys and unlock powerful AI chatbot features today.
Cursor Configuration Guide: Quick Setup
Learn how to integrate Cursor with APIpie for enhanced AI coding capabilities. Simple setup guide for API configuration with screenshots.