Viro API

Migrate to Viro

Viro speaks the OpenAI API, so moving an app from another OpenAI-compatible provider is three changes: the base URL, the API key and the model name. Your streaming, tool calling and structured outputs keep working.

Using a coding agent?

To move the agent itself (Claude Code, Codex CLI, OpenCode, Hermes Agent, Cline, Aider, Continue, OpenClaw or Cursor) onto Viro, follow its page under Integrations, or paste the Run my coding agent on Viro prompt from the Quickstart into it. The rest of this page is for code you've written yourself.

1. Point your client at Viro

Create a key on API Keys, store it as VIRO_API_KEY, and change the client:

# Python
from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.viro.app/v1",
    api_key=os.environ["VIRO_API_KEY"],
)
// TypeScript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.viro.app/v1",
  apiKey: process.env.VIRO_API_KEY,
});

If your code reads OPENAI_BASE_URL and OPENAI_API_KEY, setting those two variables is enough: OPENAI_BASE_URL=https://api.viro.app/v1.

2. Rename your models

Viro model IDs say where a model runs: viro/* for open-weight models Viro serves on clean energy, <lab>/* for frontier models routed to their lab with energy matched. Common equivalents:

FromModel you use nowOn Viro
OpenAIgpt-5.6-terraopenai/gpt-5.6-terra
Anthropicclaude-sonnet-5anthropic/claude-sonnet-5
Googlegemini-3.6-flashgoogle/gemini-3.6-flash
xAIgrok-4.5xai/grok-4.5
DeepSeek, on any hostdeepseek-v4-proviro/deepseek-v4-pro
Kimi, on any hostkimi-k2.5viro/kimi-k2.5
GLM, on any hostglm-5.3viro/glm-5.3
GPT-OSS, on any hostgpt-oss-120bviro/gpt-oss-120b
Not sure, or let Viro choose—viro/clean

The full list, with prices, is on Models or at GET https://api.viro.app/v1/models. A router (viro/clean, viro/optimized, viro/frontier) picks the model for each request; see Model Routing.

3. Check what's different
  • Rate limit: 60 requests a minute per key by default. Every response carries your current standing; see Errors for the headers and the 429 to handle.
  • Using Anthropic's SDK? Viro also serves the Messages API: set the SDK's base URL to https://api.viro.app and use your Viro key. Through the OpenAI SDK, response_format is ignored on anthropic/*.
  • GPT-5.6 with tools: OpenAI doesn't accept a reasoning setting alongside tools on this API, so on GPT-5.6 tool calls it is turned off.
  • Extra fields, safe to ignore: every response has a viro object saying where it ran and on what energy, and routed requests return the model that actually ran in x-viro-resolved-model.
  • Built-in tools: add {"type": "viro:web_search"} and Viro runs the search for you, mid-completion. If you already have your own web_search function, keep it, or switch to Viro's, but don't send both in one request. See Server tools.
  • Prompt caching is automatic where the model supports it; there's nothing to turn on. See Prompt caching.
4. Test one request
curl https://api.viro.app/v1/chat/completions \
  -H "Authorization: Bearer $VIRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "viro/clean", "messages": [{"role": "user", "content": "Say hi"}]}'

Then run your own test suite against Viro before switching production traffic. Each request shows up on Usage with its cost and energy.