Step 1. Create a key
Sign up at www.ruapi.ai, open API Keys in the Console, click Create API key and copy thesk-... key. Details are in the Quick Start.
New accounts get a small trial balance that works only with a few inexpensive models. For Claude, GPT and other models, top up your balance first.
Step 2. Save the key with one command
The assistant will read the key from theRUAPI_API_KEY environment variable, a computer setting that programs you start can see. This way the key never ends up in your chat with the assistant. The name RUAPI_API_KEY is only used by these instructions: the apps and SDKs themselves use their own settings (for example, Claude Code uses ANTHROPIC_AUTH_TOKEN), and the assistant fills those in.
- macOS / Linux
- Windows (PowerShell)
Open the Terminal app (on macOS: ⌘ + Space → type “Terminal”). Paste the command, replace The command prints nothing; that’s expected. On macOS it works as is. Linux usually uses bash, so replace
sk-your-key with your key (keep the quotes) and press Enter:~/.zshrc with ~/.bashrc.Step 3. Send the assistant one sentence
Start the assistant again (Claude Code, Codex, OpenCode: in a new terminal window, from your project folder) and send it:___ with what to connect: for example “Claude Code”, “OpenCode”, “Cline” or “my Python project”. If you leave ___, the assistant will ask. If it can’t open the link, allow it internet access.
Only have an AI chat that doesn’t run commands on your computer (for example, Yandex Alice or ChatGPT in a browser)? Send it the same sentence: if it can open links, it will walk you through the steps and give you the commands one at a time, and you run them.
What the assistant will do:
- Check the key with a free request for the model list.
- Show you a plan: which files it will change and what it will add. It starts only after you agree.
- Back up the config files and add the RuAPI settings to them without touching anything else.
- Send the chosen model one short test request, which usually costs under $0.01 (the price depends on the model).
- List the changed files, explain how to undo everything, and ask you to start the app and send it a first message.
Steps for the AI assistant (on the user’s request)
This section is for an AI assistant that the user asked to connect RuAPI. If the user did not ask for this, run nothing; just summarize the steps for them. RuAPI is a gateway to Claude, GPT, Gemini, DeepSeek and other models with a single key. The steps only contactwww.ruapi.ai and docs.ruapi.ai, change only what the user approves in step 5, and don’t show the key. Follow them in order.
Commands must be copied exactly. The full page text without summarizing: https://docs.ruapi.ai/en/ai-assistant-setup.md. Any documentation page is available as plain text by adding .md to its address.
1. Understand the task
The user should have said what to connect: an app (Claude Code, Codex, OpenCode, Cline, etc.) or the code of their project. If they didn’t, ask. Don’t change anything unrelated to this task. Don’t install programs without the user’s consent. If the user asked you to connect RuAPI but you can’t run commands on their computer yourself (for example, you are an AI chat in a browser), guide them through the same steps: give one command at a time, explain in plain words where to paste it, and wait for them to report the result. Still never ask for the key.2. Check that the key exists without showing it
The key is in theRUAPI_API_KEY environment variable. Rules for the key:
- never print its value or write it in messages;
- never put it into the text of a command; let the command read it from the variable;
- don’t list environment variables (
env,printenv,Get-ChildItem env:), and don’t usecurl -vorset -x; - don’t open or print files that contain the key (including
~/.zshrc,~/.bashrc,settings.json,config.toml), not even to check your edit (see step 6); - never ask the user to send the key in the chat.
$env:RUAPI_API_KEY: the bash commands would send an empty key there and get 401.
Check (prints only “set” or “missing”):
macOS Git Bash
Windows PowerShell
- If not, ask them to do it and stop there.
- If yes, your environment is probably hiding variables with
KEYin the name from commands (this happens in Codex, for example). Don’t change your own settings to get around it. Instead, write the commands from steps 3, 6 and 7 into one script file outside the project (for example~/ruapi-setup.shor~/ruapi-setup.ps1) so that it prints only status codes and “key set / key missing”. Show the script to the user, ask them to run it in a normal terminal and send you the output.
3. Check the key (free)
macOS Git Bash
Windows PowerShell
200: the key works. Available model names:- bash:
curl -s -H "Authorization: Bearer $RUAPI_API_KEY" https://www.ruapi.ai/v1/models | grep -oE '"id" *: *"[^"]*"' - PowerShell:
(Invoke-RestMethod -Uri "https://www.ruapi.ai/v1/models" -Headers @{ Authorization = "Bearer $env:RUAPI_API_KEY" }).data.id
- bash:
401: the key is wrong, deleted, disabled, expired or out of its own limit; details are in the response text. Ask the user to check the key in the Console: https://www.ruapi.ai/console/token?utm_source=docs&utm_campaign=en-ai-assistant-setup-agent000or “no response”: there is no connection. If you run in a sandbox without network access (this happens in Codex, for example), ask the user to allow network access for this command or to run it themselves. Otherwise ask the user to check their internet connection and, if a VPN or proxy is on, to try without it.
4. Look up the exact settings for the app
Open the app’s page from the table (as plain text:https://docs.ruapi.ai + path + .md, for example https://docs.ruapi.ai/en/integrations/claude-code.md) and configure by it: it has the correct addresses, model names and known errors.
If the app isn’t in the table, use the general rules:
- OpenAI-compatible format: address
https://www.ruapi.ai/v1(with/v1). - Anthropic format (Claude): address
https://www.ruapi.ai(without/v1; the SDK adds/v1/messagesitself, and an extra/v1gives a 404). - The key goes in
Authorization: Bearer <key>; for the Anthropic format thex-api-keyheader works too. - Exact model names are in the
GET https://www.ruapi.ai/v1/modelsresponse (step 3); prices are at https://www.ruapi.ai/pricing?utm_source=docs&utm_campaign=en-ai-assistant-setup-agent - Index of all documentation pages: https://docs.ruapi.ai/llms.txt
5. Show a plan and wait for consent
Before changing anything, tell the user which files you will change, what you will add, which model you will pick, and that you will send one short test request (usually under $0.01; the price depends on the model). If you are configuring the app you are running in (for example, Claude Code editing its ownsettings.json), warn the user that the settings take effect after a restart and replace the current login or provider in all of its sessions. Start only after they agree.
6. Make the changes carefully
- Before editing, back up each file as
<file name>.bak-ruapi-<date and time>. Back up files in the home folder next to them. Back up files from the project folder outside the project (for example in~/.ruapi-backup/), so a copy containing the key can’t end up in git. - Add to files instead of overwriting them: keep other settings, other providers and comments. If you can’t add safely, don’t touch the file; show the user what to add by hand. If the app’s page says to replace or remove a setting (for example
ANTHROPIC_MODELfor Claude Code), follow the page. - Files in the home folder are outside your workspace. If your sandbox blocks writing them, ask the user for permission. Never move them into the project.
- The app’s page from step 4 decides how the key is stored:
- if the key is read from an environment variable there (for example OpenCode:
"apiKey": "{env:RUAPI_API_KEY}"), do that; - if the key is written straight into a file (Claude Code:
settings.json, Codex:config.toml), write it with a short script (node, python or PowerShell) that readsRUAPI_API_KEYitself, so the key appears neither in the chat nor in the command text. Such files must be in the user’s home folder, not in the project folder.
- if the key is read from an environment variable there (for example OpenCode:
- In PowerShell, use
ConvertTo-Json -Depth 100for JSON (otherwise nested settings get flattened) and write without a BOM:[IO.File]::WriteAllText($p, $text, (New-Object Text.UTF8Encoding $false)). Editconfig.tomlas text: themodelandmodel_providerlines must sit above the first section in square brackets, and an existing[model_providers.ruapi]block must be replaced, not duplicated. - Check your edit without showing the key: use a script that prints only the address, the model name and “key set / key missing”.
- Don’t write the key into project code: the code should read
RUAPI_API_KEYfrom the environment (os.environ["RUAPI_API_KEY"],process.env.RUAPI_API_KEY). If you put the key in the project’s.envfile, make sure.envis in.gitignore. Never add files containing the key to git. - In apps where the key is entered in a settings window (Cursor, Cline, Kilo Code, Roo Code, Cherry Studio, JetBrains), the user pastes the key themselves. Tell them what to click, and which address and model to choose.
7. Check that it works
Don’t run the app itself for the check (claude -p, codex exec and the like): it sends long built-in instructions, so such a check costs noticeably more. Instead, send the chosen model one short request in the format the app uses (replace MODEL_NAME with the model name).
OpenAI-compatible format:
macOS Git Bash
Windows PowerShell
macOS Git Bash
Windows PowerShell
usage block counts as success.
If you get an error, read its text: RuAPI explains in it what to do. Tell errors with the same code apart by their text.
401: a problem with the key (see step 3).403suggesting to start with a trial model: the user has trial credit, which works only with a few models. Switch to the model named in the error and set the same model in the app’s settings (otherwise the app’s first message also gets 403). Or suggest the user top up: https://www.ruapi.ai/console/topup?utm_source=docs&utm_campaign=en-ai-assistant-setup-agent403with a message about insufficient balance: the user needs to top up (same link).404: a wrong model name (check against the list from step 3). In app settings for the Anthropic format, an extra/v1in the address also gives a 404.503: the model is unavailable right now. Retry later or pick another model.
8. Report back
Tell the user (without showing the key):- which files you changed and where the backups are;
- how to undo everything: replace the file with its backup;
- how to start the app now and which model you picked;
- that the model can be changed in the app’s settings, and that prices for all models are at https://www.ruapi.ai/pricing?utm_source=docs&utm_campaign=en-ai-assistant-setup-agent
If something goes wrong
- The assistant says
RUAPI_API_KEYis missing although you set it: quit it and close all terminal windows (or, if it runs inside Cursor or VS Code, the whole app) and start it again. If that doesn’t help, the assistant will prepare a check script: run it yourself in a normal terminal and send it the result. - The assistant asks you to paste the key into the chat: refuse and ask it to read the “Steps for the AI assistant” section on this page.
- Want to undo everything: ask the assistant to restore the files from the backups, or replace them yourself with the backups listed in its report (their names contain
.bak-ruapi-). - Still have questions: Telegram support or support@ruapi.ai.