Use nanobot with Models Hub: Edit config.json
Configure nanobot's providers and agents.defaults in config.json to point at Models Hub, with install steps, recommended models, and error fixes.
nanobot (project: HKUDS/nanobot) is a lightweight, open-source personal AI agent framework with a web UI, Telegram, Discord, and Slack channels, plus tool calling and long-term memory. It configures model providers through a single config.json file; point a provider at Models Hub and nanobot's conversations and automations draw on your Models Hub balance. This page covers only the connection step — see the project docs for everything else.
Three things you need
A Models Hub API key, the endpoint https://modelsok.com/v1 (must end with /v1), and a model name.
Prerequisites
- uv installed.
- A Models Hub API key from the Tokens page, in a group that can access the models you want.
Recommended models
| Use case | Model | Pricing | Live status |
|---|---|---|---|
| First choice for everyday chat, a balance of speed and quality | claude-sonnet-4-6 | Price | Availability and latency |
| Complex reasoning and long context | gpt-5.5 | Price | Availability and latency |
| Cheap and fast, good for high-frequency tasks | gpt-5.4-mini | Price | Availability and latency |
Model names are authoritative on the pricing page.
Setup
-
Install nanobot:
uv tool install nanobot-aiWindows users need to add
.local/binto their environment variables to invokenanobotdirectly:$env:PATH = "$env:USERPROFILE\.local\bin;$env:PATH"Run
nanobot --versionto confirm it installed. -
Initialize the configuration:
nanobot onboardThis creates a config file in your home directory:
%USERPROFILE%\.nanobot\config.jsonon Windows,~/.nanobot/config.jsonon Linux/macOS. -
Edit
config.jsonto pointprovidersandagents.defaultsat Models Hub:{ "agents": { "defaults": { "model": "claude-sonnet-4-6", "provider": "modelsok" } }, "providers": { "modelsok": { "apiKey": "your-modelsok-api-key", "apiBase": "https://modelsok.com/v1" } } }apiBasemust end with/v1;modelmust be a model ID actually exposed in the Models Hub console. Multiple providers can be configured side by side;agents.defaults.providerpicks which one is used by default. Note: newer versions also support defining multiple models undermodelPresetsand referencing one by name viamodelPreset— the direct fields shown here are the backward-compatible form; check your installed version if unsure.
Verify
Start an interactive conversation:
nanobotType any question, such as "Hello, tell me what day of the week it is today." A normal response means the configuration worked. Then check Usage logs in the Models Hub console; a request under that model name appears within seconds, confirming traffic went through Models Hub.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
nanobot command not found | Windows users haven't added .local/bin to PATH | Run the PATH command above and reopen your terminal |
| 401 Unauthorized | apiKey isn't filled in correctly, or the token is disabled | Re-copy from the Tokens page |
| Model not found | model doesn't match a model ID in the Models Hub console, or apiBase is missing /v1 | Check the model name and URL against the pricing page |
| Configuration changes have no effect | Config changes require a restart to take effect | Save the file and re-run nanobot |
More in Troubleshooting.
FAQ
How is it billed? Per input and output token actually consumed per request, at the price on each model's pricing page.
How is this different from using the official API directly? Same request format; only apiBase changes to the Models Hub endpoint.
How do I switch models? Edit agents.defaults.model in config.json, save it, and restart nanobot.
Related
Use LangBot with Models Hub: Add a Model and Pipeline
Add a model in LangBot pointed at Models Hub, wire it into a pipeline, and use it across Feishu, DingTalk, WeChat, and QQ, with recommended models, embeddings, and error fixes.
Use NextChat with Models Hub: Custom Endpoint Setup
Turn on the custom endpoint in NextChat (ChatGPT-Next-Web), on the official site or a self-hosted instance, and point it at Models Hub, with verification and error troubleshooting.