Install
Install the Codex CLI. For the ChatGPT desktop app, see ChatGPT Desktop.Usage with Ollama
Use a context window of at least 64k tokens for Codex.
Quick setup
ollama launch codex, Ollama refreshes the model catalog
and uses a dedicated Codex profile for that session.
Type /model inside Codex to switch between your installed, tool-capable Ollama
models without restarting. The starting model remains selected, and each model
keeps its own context window, vision, and thinking settings. Pull additional
models with ollama pull <model> before launching to include them in the picker.
To configure without launching:
Manual setup
To usecodex with Ollama, use the --oss flag:
-m flag:
Profile-based setup
For a persistent Codex CLI configuration, create~/.codex/ollama-launch.config.toml:
Web search through local Ollama
Codex web-search requests sent through the Ollama profile are executed by Ollama for both local and cloud models. Sign in withollama signin to use the
web-search service.
To disable web search for a Codex session:

