Viro API

Integrations / Claude Code

Claude Code

Run Claude Code on Viro, so every turn goes to renewable-verified or energy-matched compute. Viro serves Anthropic's Messages API at https://api.viro.app/v1/messages, so Claude Code works unchanged: point it at Viro with a few environment variables. Tested with Claude Code 2.1.330.

Quickest: install 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. 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, which can also check your key, usage and failed requests. Source: nick-viro/viro-skills.

Prefer to do it yourself? Follow the steps below.

1. Point Claude Code at Viro

Create a key on API Keys and add this to ~/.claude/settings.json (merge the env block into yours if the file already exists). It applies to every Claude Code session:

{
  "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"
  }
}

Or, for one shell only:

export ANTHROPIC_BASE_URL=https://api.viro.app
export ANTHROPIC_AUTH_TOKEN=$VIRO_API_KEY
export ANTHROPIC_MODEL=viro/clean
export ANTHROPIC_DEFAULT_HAIKU_MODEL=viro/gpt-oss-20b
export 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; see Model Routing for the others, or name any model from Models.
  • ANTHROPIC_DEFAULT_HAIKU_MODEL is what Claude Code uses for quick background work, like titles and summaries.
  • CLAUDE_CODE_MAX_CONTEXT_TOKENS tells Claude Code how big the conversation can get before it compacts. It doesn't know Viro's model names, so without this it assumes 1M tokens. Routers never pick a model too small for the conversation.
2. Check it

Start a new session. To check from a terminal:

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

The request shows up on Usage. Claude Code may note that it doesn't recognise the model name; that's expected for a Viro ID and harmless once CLAUDE_CODE_MAX_CONTEXT_TOKENS is set.

What works
  • All of Claude Code's own tools (files, shell, edits), 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.
  • Claude models: Claude Code's own model names (for example claude-sonnet-5) run as anthropic/claude-sonnet-5, energy matched.
  • Prompt caching is automatic where the model supports it; cache_control markers are accepted and not needed.

Anthropic-only extras that have no Viro equivalent, such as code execution and the Files and Batches APIs, aren't available.