AI

How to Run Claude Code on Clean Energy

Point Claude Code at the Viro API with a few settings and every turn runs on renewable-powered or energy-matched models. Keep your CLAUDE.md, skills and MCP servers. Plugin, config and what works.

Claude Code is one of the best coding agents around. You can now run it on clean energy without changing how you work: same CLI, same CLAUDE.md, same skills and MCP servers. Only the models behind it change.

The Viro API speaks Anthropic’s Messages API, which is what Claude Code talks to. Point Claude Code at it and every turn runs on models hosted on 100% renewable energy, or on frontier models like Claude with their electricity matched with renewables. We tested everything below with Claude Code 2.1.330.

The quickest way: the Viro plugin

Inside Claude Code, run:

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

Then ask it to “run this agent on Viro”. It asks for your key, writes the settings below for you, 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

Add this to ~/.claude/settings.json (merge the env block into yours if the file exists):

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.viro.app",
    "ANTHROPIC_AUTH_TOKEN": "viro_sk_live_...",
    "ANTHROPIC_MODEL": "viro/clean",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "viro/gpt-oss-20b",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "200000"
  }
}
  • ANTHROPIC_BASE_URL has no /v1: Claude Code adds /v1/messages itself.
  • ANTHROPIC_MODEL is the model for every turn. viro/clean only runs on renewable-verified infrastructure.
  • ANTHROPIC_DEFAULT_HAIKU_MODEL handles quick background work like titles and summaries, so a small model saves money there.
  • CLAUDE_CODE_MAX_CONTEXT_TOKENS tells Claude Code when to compact, since it doesn’t know Viro’s model names.

Start a new session and check it:

claude -p "Reply with exactly the word: pong"

The request shows up on your Usage page with its cost and energy. Claude Code may note that it doesn’t recognise the model name; that’s expected 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
Claude Sonnet 5 Energy matched $3.00 / $15.00 When you want Claude itself
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. To use Claude itself, set ANTHROPIC_MODEL to claude-sonnet-5 and it runs as anthropic/claude-sonnet-5.

What works

  • All of Claude Code’s own tools: files, shell, edits, plus streaming, images and PDFs.
  • Web search: Claude Code’s WebSearch runs on Viro’s web search ($0.01 a search).
  • Thinking: extended thinking maps to the model’s reasoning effort.
  • Prompt caching is automatic where the model supports it.
  • Your setup: CLAUDE.md, skills, hooks, MCP servers and slash commands are untouched.

Anthropic-only extras with no Viro equivalent, like code execution and the Files and Batches APIs, aren’t available.

Ask Claude Code about your own usage

The plugin also connects Viro’s MCP server. With VIRO_API_KEY exported in your shell, you can ask Claude Code things like “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 CLAUDE.md and skills. Using Codex? See how to run Codex on clean energy.

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

Frequently asked questions

Can Claude Code use a custom API?

Yes. Claude Code reads ANTHROPIC_BASE_URL and talks to any server that speaks Anthropic's Messages API. The Viro API serves it at https://api.viro.app/v1/messages, so Claude Code works unchanged once you set the base URL, a key and a model.

Do I keep my CLAUDE.md, skills and MCP servers?

Yes. Nothing about your project changes. Only the model provider does, through a few environment variables in ~/.claude/settings.json.

Can I still use Claude models?

Yes. Claude Code's own model names, like claude-sonnet-5, run as anthropic/claude-sonnet-5 through Viro. They run on Anthropic's infrastructure with their electricity matched with renewable energy, labelled Energy Matched.

Which model should I use?

viro/clean picks a model on 100% renewable-powered infrastructure for each request. Kimi K2.7 Code is built for coding and also runs on renewable power. viro/frontier picks the strongest model available, whatever its energy source.

Does web search still work?

Yes. Claude Code's WebSearch runs on Viro's server-side web search, at $0.01 a search.

What doesn't work?

Anthropic-only extras with no Viro equivalent, such as code execution and the Files and Batches APIs.

Sources

  1. LLM gateway configuration, Claude Code docs
  2. Claude Code settings, Claude Code docs
  3. Claude Code integration guide, Viro
  4. Viro plugin for Claude Code and Codex, GitHub

Cover photo by Chris Ried on Unsplash

Chat with AI that funds clean energy

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

Try Viro AI