OpenAI Codex Installation and Configuration Guide
A clean setup flow for installing Codex, adding external LLM provider access, storing credentials safely, and verifying the workflow before you use it for real projects.
What this setup gives you
One Codex workspace with repeatable model routing.
Before you start
Collect the setup details first. It prevents half-finished configuration work and gives Codex the exact inputs it needs to update files correctly.
1. Install Codex
- Install OpenAI Codex using the official method available for your environment.
- Open a new terminal or app session so the command path refreshes cleanly.
- Start Codex in an empty test folder or a small project, then ask it a basic question.
- Confirm Codex can read local files only when you intentionally provide a workspace.
- Keep the base OpenAI setup working before adding MiniMax or any other provider.
Prompt to use: Check whether Codex is installed correctly on this machine, tell me the command or app path you found, and run a tiny smoke test without changing any files.
2. Configure provider access
After Codex works on its own, add the external provider configuration. Keep it small and readable: provider name, endpoint, wire format, model IDs, and the secure secret reference.
3. Store credentials safely
Do not paste API keys into AGENTS.md, README files, provider catalogs, screenshots, or chat transcripts. Store the key in the operating system credential store and reference it indirectly.
- Windows 10/11: Use Windows Credential Manager or a secure secret store exposed to the shell when needed.
- macOS 13+: Use Keychain Access or the security command-line interface to store and retrieve the provider key.
- Any platform: Use environment variables only when injected at runtime and never committed to the repository.
Prompt to use: Create a secure local credential entry for my provider API key, then update the Codex provider configuration so it references the secret by name instead of storing the key in a file.
4. Connect the LLM provider
- Add the provider entry with the base URL, wire format, model list, and secret reference.
- Run a direct test against one small model request, such as a one-sentence response.
- If the request fails, check the base URL, API key, model ID, and wire format before changing anything else.
- Once direct access works, add routing instructions in AGENTS.md.
- Run a second test that asks Codex to explain which model it selected and why.
5. Add routing instructions
Routing instructions make the setup usable day to day. Keep them short and operational: which model should plan, which model should execute routine work, which model should handle long-context tasks, and when Codex should stay on OpenAI models.
Use OpenAI Codex models for high-level planning, architecture judgment, security-sensitive review, and final decisions. Use MiniMax or the configured external LLM for low-risk implementation, boilerplate, documentation drafts, unit tests, lint fixes, and long-context routine work when it is available. Never expose API keys in files or logs.Final setup checklist
- Codex opens and answers a basic request.
- You have the API key, base URL, wire format, and model IDs.
- The API key is saved in Credential Manager, Keychain, or another secure runtime store.
- The provider catalog references the provider without exposing secrets.
- A direct model smoke test returns a response.
- AGENTS.md explains when to use OpenAI models and when to use the external LLM.
- A test task uses the intended model path and leaves no secret in project files.
Next step
Want this connected to your real business workflows?
The guide helps you set up the tool. The bigger advantage comes from knowing which automations are worth building for your business.