nanobot
Connect nanobot to RealRelay.ai as a custom OpenAI-compatible provider: install it, add a provider and a model preset to config.json, check the setup and switch models.
- Protocol
- OpenAI Chat Completions
- Base URL
https://www.realrelay.ai/v1- Official docs
- github.com
- Checked against the tool’s docs
- 2026-10
Overview
nanobot is a small, open-source personal agent from HKUDS. It runs on your own machine, works with files, remembers preferences and runs scheduled tasks, and you talk to it in a browser, the terminal or a chat app. You add RealRelay.ai as a custom provider, which uses the OpenAI Chat Completions API (/v1/chat/completions).
An API key from the API keys page of the console.
The base URL with
/v1at the end. nanobot does not guess a URL for custom providers, so this field is required.A model ID exactly as
GET /v1/modelslists it, for examplez-ai/glm-5.2. Pick one that supports tool calling.
nanobot cannot read a model's context window from RealRelay.ai. Set it in the model preset, as shown under Configure. This page is about the nanobot agent published as nanobot-ai on PyPI, not other projects with the same name.
Install
nanobot needs Python 3.11 or later. The official installer picks an isolated Python environment for you and opens setup when it finishes. If you already use uv, install the package yourself instead.
curl -fsSL https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.sh | shirm https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.ps1 | iexuv tool install nanobot-ainanobot onboardThe installer prints the exact command it used to run nanobot. Keep it: if nanobot is not on your PATH, use that command in its place everywhere below.
Configure
You can set the provider in the browser under Settings → Models: create a new preset, choose Add provider in the Provider menu and enter its connection details. The steps below edit the same settings in the file directly.
- 1
Save the key in an environment variable
This keeps the key out of the config file. Open a new terminal afterwards.
~/.zshrc · ~/.bashrc export REALRELAY_API_KEY="sk-***"Windows PowerShell [Environment]::SetEnvironmentVariable("REALRELAY_API_KEY", "sk-***", "User") - 2
Add a provider and a model preset
Merge these blocks into
~/.nanobot/config.json, keeping the other settings that are already there. If the file does not exist yet, runnanobot onboardfirst.~/.nanobot/config.json 1{2 "providers": {3 "realrelay": {4 "apiKey": "${REALRELAY_API_KEY}",5 "apiBase": "https://www.realrelay.ai/v1"6 }7 },8 "modelPresets": {9 "primary": {10 "provider": "realrelay",11 "model": "z-ai/glm-5.2",12 "maxTokens": 8192,13 "contextWindowTokens": 20000014 }15 },16 "agents": {17 "defaults": {18 "modelPreset": "primary"19 }20 }21} - 3
Restart nanobot
nanobot fills in the key when it starts. If a WebUI or gateway was already running, stop it and start it again.
realrelayis a name you choose for the provider. It must match theproviderin the preset, and must not be a built-in provider name such asopenai.${REALRELAY_API_KEY}is filled in from the environment at startup. The value is never written back to the file.Setting
providerexplicitly matters here. With it, nanobot sendsz-ai/glm-5.2as written. Left onauto, nanobot may read the part before the slash as a provider name.contextWindowTokensis the model's window andmaxTokenscaps one reply. The values shown are safe lower bounds; use the numbers on the model's catalog page.
Verify
- 1
Call the endpoint directly
Run this with your key. A JSON reply with a
choicesarray means the address, key and model work.Terminal 1curl -sS "https://www.realrelay.ai/v1/chat/completions" \2 -H "Authorization: Bearer sk-***" \3 -H "content-type: application/json" \4 -d '{"model": "z-ai/glm-5.2", "max_tokens": 16, "messages": [{"role": "user", "content": "Reply with OK"}]}' - 2
Check nanobot's setup and send one message
nanobot statuschecks the config without calling the model. It should show check marks for Config and Workspace, theprimarypreset, and the provider as configured. The second command sends one message.Terminal nanobot statusnanobot agent -m "Reply with OK" - 3
Check the reply
Any normal answer means nanobot can load the config and reach the model. The request appears in the console's usage logs. Then try the same in the WebUI with
nanobot webui.
Models
Each model is a named preset. Add one preset per RealRelay.ai model, each with its own limits:
1"claude": {2 "provider": "realrelay",3 "model": "anthropic/claude-sonnet-4-6",4 "maxTokens": 8192,5 "contextWindowTokens": 2000006}Switch the current session to it with /model and the preset name. The choice applies to that session only; agents.defaults.modelPreset stays the default for new ones.
/model claudeDo not name a preset default; that name is reserved. To fall back to another preset when a request fails, list it in agents.defaults.fallbackModels. Models that work well for agents are listed under Choosing a model.
Troubleshooting
nanobot stops at startup and names
REALRELAY_API_KEY. The variable is not set in the environment that started nanobot. Set it, open a new terminal and start again.401 or "invalid API key". The key is wrong, has a space at either end, or sits under a different provider name than the preset uses.
404.
apiBaseis missing/v1. Add it.Model not found. The model ID does not match
GET /v1/modelsexactly, or the preset'sproviderisautoand nanobot sent it somewhere else. Setprovidertorealrelay."provider not found". The preset's
provideris spelled differently from the key underproviders.JSON parse error. A comma or brace is missing after merging the blocks. The examples here are pieces of the file, not the whole file.
Changes have no effect. nanobot was already running when you edited the file. Restart the WebUI or gateway.
Works with
nanobot agentbut not in a chat app. The model setup is fine. Check the channel settings withnanobot channels status.
