# Codex CLI

Run OpenAI's Codex CLI on Vultr Serverless Inference: one install writes a vultr profile and a live model list, and codex -p vultr uses them.

Codex has no plugin hook for model providers, so `@vultr/model-provider-codex` writes the two things Codex reads instead: a model list in Codex's own format, and a `vultr` profile that points Codex at the API. Your `config.toml` is never touched.

## Set it up

```bash
npx @vultr/model-provider-codex install
export VULTR_INFERENCE_API_KEY=...
codex -p vultr
```

The first `codex -p vultr` asks you to review a new `SessionStart` hook: trust it. From then on every session start keeps the model list current. `codex exec` skips a hook that is not trusted yet without saying so.

| Option of `install` | What it does |
| --- | --- |
| `--model <id>` | The profile's model; the first in the list unless set, and a reinstall keeps your choice |
| `--no-hook` | No refresh hook. Run `npx @vultr/model-provider-codex refresh` to update the list |
| `--codex-home <dir>` | Where Codex keeps its config: `$CODEX_HOME`, or `~/.codex` |
| `--base-url <url>` | `$VULTR_INFERENCE_BASE_URL`, or `https://api.vultrinference.com/v1` |

## Pick a model

`/model` in Codex lists every model the provider offers, with its reasoning levels; your choice is kept in the profile. The hook fetches the list at most every 10 minutes, and Codex reads it before the hook runs, so a new model appears in the next session.

## What it writes

| File | What it holds |
| --- | --- |
| `<CODEX_HOME>/vultr.config.toml` | The `vultr` profile: provider, model, the model list, `web_search = "disabled"`, and the hook |
| `<CODEX_HOME>/vultr/models.json` | The model list in Codex's format |
| `<CODEX_HOME>/vultr/catalog-cache.json` | The last good `GET /v1/models` answer |
| `<CODEX_HOME>/vultr/dist/` | The copy of the tool the hook runs |

Codex writes into the profile too: your `/model` choice, trusted hooks and projects. Running `install` again keeps them.

## Update or remove it

Run `npx @vultr/model-provider-codex install` again to upgrade: it is idempotent and the hook stays trusted. `npx @vultr/model-provider-codex uninstall` removes everything it wrote.

## What works

- Codex's own tools: the shell, `apply_patch` and the rest of its tool set. The API takes the [custom and namespace tools](/docs/reference/create-response) Codex sends.
- Images in the prompt, on models that read them.
- Web search is off in the profile: the API has no hosted tools.
