# 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](https://console.viro.app/docs/integrations), or paste the **Run my coding agent on Viro** prompt from the [Quickstart](https://console.viro.app/docs) 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](https://console.viro.app/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:

| From | Model you use now | On Viro |
| --- | --- | --- |
| OpenAI | gpt-5.6-terra | openai/gpt-5.6-terra |
| Anthropic | claude-sonnet-5 | anthropic/claude-sonnet-5 |
| Google | gemini-3.6-flash | google/gemini-3.6-flash |
| xAI | grok-4.5 | xai/grok-4.5 |
| DeepSeek, on any host | deepseek-v4-pro | viro/deepseek-v4-pro |
| Kimi, on any host | kimi-k2.5 | viro/kimi-k2.5 |
| GLM, on any host | glm-5.3 | viro/glm-5.3 |
| GPT-OSS, on any host | gpt-oss-120b | viro/gpt-oss-120b |
| Not sure, or let Viro choose | — | viro/clean |

The full list, with prices, is on [Models](https://console.viro.app/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](https://console.viro.app/docs/routing).

## 3. Check what's different

-   **Rate limit:** 60 requests a minute per key by default. Every response carries your current standing; see [Errors](https://console.viro.app/docs/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](https://console.viro.app/docs/tools).
-   **Prompt caching** is automatic where the model supports it; there's nothing to turn on. See [Prompt caching](https://console.viro.app/docs/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](https://console.viro.app/usage) with its cost and energy.

---
Source: https://console.viro.app/docs/migrate
