Skip to main content
OpenCode is an open-source AI coding agent that runs in your terminal: it reads and edits project files, runs commands and sees a task through from start to finish. It isn’t tied to a single model vendor, so it connects to RuAPI directly. RuAPI gives you access to Claude, GPT, Gemini, DeepSeek, GLM, Qwen and Kimi with a single API key, and works from Russia without a VPN. You top up your balance in USDT; no foreign-issued card required.

How it works

In OpenCode, models are connected through providers defined in opencode.json. For RuAPI you need two:

Before you start

1

RuAPI API key

Sign up at www.ruapi.ai and top up your balance (how to top up). Then go to Console → API Keys and click Create API key. Keys start with sk-.
2

OpenCode installed

On macOS and Linux:
Or via npm on any OS, including Windows:
On Windows, the OpenCode team recommends running it under WSL.
No bank card needed: you can top up your balance in USDT. If you don’t have USDT yet, follow our step-by-step guide to buying it with rubles. Foreign-issued cards are accepted too.

Step 1. Store your key in an environment variable

To keep the key out of your config file, OpenCode will read it from the RUAPI_API_KEY environment variable.
Add the line to ~/.zshrc (or ~/.bashrc if you use bash), with your own key:
Then open a new terminal window for the change to take effect.

Step 2. Define the providers in opencode.json

Open (or create) the global config file ~/.config/opencode/opencode.json and paste:
What this does:
  • anthropic is OpenCode’s built-in Claude provider. The config only points it at RuAPI and passes in your key, so requests use Claude’s native format, with caching.
  • ruapi is a custom provider for all other models. To add a model, add a line to the models block, e.g. "kimi/kimi-k3": { "name": "Kimi K3" }. You’ll find the exact model names on the pricing page.
  • model sets the default model in provider/model format.
If your project folder also has an opencode.json, OpenCode merges the two files, and project settings take precedence. Don’t put the key directly in a project file — use {env:RUAPI_API_KEY} as in the example.

Step 3. Start OpenCode and pick a model

Go to your project folder and start the agent:
In OpenCode, type /models and pick a model — for example, anthropic/claude-sonnet-5-5 or ruapi/deepseek-flash. Then give it a task:
To confirm that requests are going through RuAPI, open Console → Usage Logs: you’ll see an entry for each request with the model and cost. For Claude, from the second or third step onward the entry details show how many tokens were read from the cache.

Which model to pick

Troubleshooting

  • Make sure RUAPI_API_KEY is available in the terminal where OpenCode runs: after creating the variable, open a new window.
  • baseURL must be https://www.ruapi.ai/v1 for both providers.
OpenCode takes the model list for the built-in anthropic provider from its own catalog. Update OpenCode; if the model is still missing, add a models section to the anthropic block with the name you need, e.g. "claude-opus-5-5": { "name": "Claude Opus 5.5" }.
The model name must match the one on RuAPI exactly — copy it from the pricing page. Pick Claude models from the anthropic provider and all other models from ruapi.
Make sure the JSON is valid: all quotes are double quotes, and there’s no trailing comma after the last item in a block.
This can happen with DeepSeek in reasoning mode if you switch models mid-task. In most cases RuAPI automatically fixes and retries the request. If the error persists, start a new session.

What’s next