[Integrations](https://console.viro.app/docs/integrations) / Codex CLI

# Codex CLI

Run OpenAI's Codex CLI on Viro, so every turn goes to renewable-verified or energy-matched compute. Codex only speaks the Responses API to custom providers, and Viro serves it at `https://api.viro.app/v1/responses`. Tested with Codex CLI 0.171.0.

## Quickest: install the Viro plugin

In a terminal, run:

```
codex plugin marketplace add nick-viro/viro-skills
codex plugin add viro@viro
```

Then ask it to `run this agent on Viro`. The plugin's setup skill asks for your key, writes the settings below for you, sends a test request and tells you how to switch over. The plugin also adds a skill for moving an app's code to Viro, one for picking a model from the live catalog, and Viro's [MCP server](https://console.viro.app/docs/mcp), which can also check your key, usage and failed requests. Source: [nick-viro/viro-skills](https://github.com/nick-viro/viro-skills).

Prefer to do it yourself? Follow the steps below.

## 1. Make your API key available

Create a key on [API Keys](https://console.viro.app/api-keys) and export it from your shell profile (`~/.zshrc` or `~/.bashrc`):

```
export VIRO_API_KEY=viro_sk_live_...
```

## 2. Add Viro and make it the default

Add this to `~/.codex/config.toml`. If the file already sets `model` or `model_provider`, replace those two lines; your other providers stay available.

```
model = "viro/clean"
model_provider = "viro"
model_context_window = 200000

[model_providers.viro]
name = "Viro"
base_url = "https://api.viro.app/v1"
env_key = "VIRO_API_KEY"
wire_api = "responses"
```

-   `model` is the default for every turn. `viro/clean` only runs on renewable-verified infrastructure; see [Model Routing](https://console.viro.app/docs/routing) for the others, or pick per run with `codex -m viro/frontier`.
-   `model_context_window` tells Codex when to compact the conversation. Routers never pick a model too small for it.

## 3. Check it

```
codex exec "Reply with exactly the word: pong"
```

The request shows up on [Usage](https://console.viro.app/usage). Codex warns that it has no metadata for `viro/clean`; that's expected for a model name it doesn't ship with, and harmless.

## What works

-   Codex's shell, file and patch tools, streaming, images, and reasoning effort.
-   **MCP servers** you've added to Codex, including Viro's own docs server.
-   **Web search**, when you turn on live web access in Codex: it runs on Viro's [web search](https://console.viro.app/docs/tools) ($0.01 a search).

Viro keeps no conversation state, so `previous_response_id` and `store: true` are refused; Codex doesn't use them.

---
Source: https://console.viro.app/docs/integrations/codex
