Coding agents

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 /v1 at the end. nanobot does not guess a URL for custom providers, so this field is required.

  • A model ID exactly as GET /v1/models lists it, for example z-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.

macOS · Linux
curl -fsSL https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.sh | sh
Windows PowerShell
irm https://raw.githubusercontent.com/HKUDS/nanobot/main/scripts/install.ps1 | iex
uv (Python 3.11+)
uv tool install nanobot-ainanobot onboard

The 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. 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. 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, run nanobot onboard first.

    ~/.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. 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.

  • realrelay is a name you choose for the provider. It must match the provider in the preset, and must not be a built-in provider name such as openai.

  • ${REALRELAY_API_KEY} is filled in from the environment at startup. The value is never written back to the file.

  • Setting provider explicitly matters here. With it, nanobot sends z-ai/glm-5.2 as written. Left on auto, nanobot may read the part before the slash as a provider name.

  • contextWindowTokens is the model's window and maxTokens caps one reply. The values shown are safe lower bounds; use the numbers on the model's catalog page.

Verify

  1. 1

    Call the endpoint directly

    Run this with your key. A JSON reply with a choices array 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. 2

    Check nanobot's setup and send one message

    nanobot status checks the config without calling the model. It should show check marks for Config and Workspace, the primary preset, and the provider as configured. The second command sends one message.

    Terminal
    nanobot statusnanobot agent -m "Reply with OK"
  3. 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:

~/.nanobot/config.json → modelPresets
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.

nanobot chat
/model claude

Do 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. apiBase is missing /v1. Add it.

  • Model not found. The model ID does not match GET /v1/models exactly, or the preset's provider is auto and nanobot sent it somewhere else. Set provider to realrelay.

  • "provider not found". The preset's provider is spelled differently from the key under providers.

  • 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 agent but not in a chat app. The model setup is fine. Check the channel settings with nanobot channels status.