AI

How to Run Codex CLI on Clean Energy

Add Viro as a model provider in Codex's config.toml and every turn runs on renewable-powered or energy-matched models. Keep your AGENTS.md and MCP servers. Plugin, config and what works.

OpenAI’s Codex CLI can use any model provider that speaks the Responses API. The Viro API does, so you can run Codex on clean energy and keep everything else the same: your AGENTS.md, your MCP servers, the way you work.

Point Codex at Viro and every turn runs on models hosted on 100% renewable energy, or on frontier models like GPT-5.6 with their electricity matched with renewables. We tested everything below with Codex CLI 0.171.0.

The quickest way: the Viro plugin

In a terminal, run:

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

Then ask Codex to “run this agent on Viro”. It asks for your key, adds the provider below, sends a test request and tells you how to switch over. You’ll need a key from console.viro.app (new accounts get free credit, no card).

Or set it up yourself

Export your key from your shell profile (~/.zshrc or ~/.bashrc):

export VIRO_API_KEY=viro_sk_live_...

Then 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. Pick per run with codex -m viro/frontier.
  • model_context_window tells Codex when to compact the conversation.

Open a new terminal (so VIRO_API_KEY is set) and check it:

codex exec "Reply with exactly the word: pong"

The request shows up on your Usage page with its cost and energy. Codex warns that it has no metadata for viro/clean; that’s expected for a model name it doesn’t ship with, and harmless.

Which model to pick

Model Energy Price per 1M tokens (in / out) Good for
viro/clean (router) 100% renewable Varies by model The default: a clean model picked per request
Kimi K2.7 Code 100% renewable $1.56 / $6.24 Day-to-day coding agent work
DeepSeek V4.1 Flash 100% renewable $0.36 / $1.80 Fast, cheap edits and questions
GPT-5.6 Terra Energy matched $3.00 / $18.00 When you want OpenAI’s models
viro/frontier (router) Either Varies by model The strongest model available

Prices from the Viro API catalog in November 2026; see the live model list for current prices.

What works

  • Codex’s shell, file and patch tools, streaming, images, and reasoning effort.
  • Web search, when you turn on live web access in Codex: it runs on Viro’s web search ($0.01 a search).
  • MCP servers you’ve added to Codex.
  • Your setup: AGENTS.md and the rest of your config are untouched.

Viro keeps no conversation state, so previous_response_id and store: true are refused; Codex doesn’t use them. Codex’s sub-agent tools aren’t available.

Ask Codex about your own usage

The plugin also connects Viro’s MCP server. With VIRO_API_KEY set, you can ask Codex “is my Viro key working?”, “what did I spend this week?” or “why did my last request fail?”, and it answers from your account.

Why bother?

Coding agents use far more AI than chat. Every step of a task sends your context back to the model, so a long session adds up. Running it on renewable-powered models, and using small models for small jobs, makes a real difference. We dig into the numbers in the environmental footprint of AI coding agents.

Viro’s open models run in data centers powered by 100% renewable energy, and the API doesn’t store your prompts or code for Viro-hosted models. Frontier models run on their makers’ infrastructure; Viro matches their electricity with renewable energy and labels them separately, so you always know which is which.

Prefer an open-source agent?

OpenCode runs on the Viro API too, and reads your AGENTS.md. Using Claude Code? See how to run Claude Code on clean energy.

Get a free Viro API key and run Codex on clean energy.

Frequently asked questions

Can Codex CLI use a custom model provider?

Yes. Codex reads custom providers from ~/.codex/config.toml under [model_providers.<name>]. It speaks OpenAI's Responses API to them, and the Viro API serves that at https://api.viro.app/v1/responses.

Do I keep my AGENTS.md and MCP servers?

Yes. Only the model provider changes. Your AGENTS.md, MCP servers and other settings stay as they are.

Can I still use GPT models?

Yes. openai/gpt-5.6-terra and other OpenAI models are available through Viro. They run on OpenAI's infrastructure with their electricity matched with renewable energy, labelled Energy Matched.

Does web search work?

Yes, when you turn on live web access in Codex. It runs on Viro's server-side web search, at $0.01 a search.

What doesn't work?

Viro keeps no conversation state, so previous_response_id and store: true are refused; Codex doesn't use them. Codex's sub-agent tools aren't available.

Sources

  1. Codex advanced configuration, OpenAI
  2. Codex configuration reference, OpenAI
  3. Codex CLI integration guide, Viro
  4. Viro plugin for Claude Code and Codex, GitHub

Cover photo by Markus Spiske on Unsplash

Chat with AI that funds clean energy

Viro AI is free on web, iPhone, Android, Mac and Windows.

Try Viro AI