Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

1.9 KB
Raw Blame
---
title: Codex CLI
---


## Install

Install the [Codex CLI](https://developers.openai.com/codex/cli/). For the ChatGPT desktop app, see [ChatGPT Desktop](/integrations/chatgpt).

```
npm install -g @openai/codex
```

## Usage with Ollama

<Note>Use a context window of at least 64k tokens for Codex.</Note>

### Quick setup

```
ollama launch codex
```

When launched through `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:

```shell
ollama launch codex --config
```

To remove the Ollama launch profile and generated model catalog:

```shell
ollama launch codex --restore
```

### Manual setup

To use `codex` with Ollama, use the `--oss` flag:

```
codex --oss
```

To use a specific model, pass the `-m` flag:

```
codex --oss -m gpt-oss:120b
```

To use a cloud model:

```
codex --oss -m gpt-oss:120b-cloud
```

### Profile-based setup

For a persistent Codex CLI configuration, create `~/.codex/ollama-launch.config.toml`:

```toml
model = "gpt-oss:120b"
model_provider = "ollama-launch"
model_catalog_json = "/Users/you/.codex/model.json"

[model_providers.ollama-launch]
name = "Ollama"
base_url = "http://localhost:11434/v1/"
wire_api = "responses"
```

Then run:

```
codex --profile ollama-launch
```

## 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 with `ollama signin` to use the
web-search service.

To disable web search for a Codex session:

```shell
codex --profile ollama-launch -c 'web_search="disabled"'
```