The Nano Bots API leverages ruby-nano-bots to create an HTTP API, enabling you to integrate your Nano Bots through web requests.
Nano Bots are small, AI-powered bots that can be easily shared as a single file, designed to support multiple providers such as Anthropic Claude, Cohere Command, Google Gemini, Maritaca AI MariTalk, Mistral AI, Ollama, OpenAI ChatGPT, and others, with support for calling tools (functions).
This API is available for free as a public API at: https://api.nbots.io
It is used to power the following projects:
- Nano Bots for Sublime Text
- Nano Bots for Visual Studio Code
- Nano Bots for Obsidian
- Nano Bots Clinic (Live Editor)
- Nano Bots Marketplace
Requirements:
build-essential libffi-dev libsodium-dev lua5.4-dev
git clone https://github.com/icebaker/nano-bots-api.git
cd nano-bots-api
Copy the .env.example
file to .env
and fill in the necessary data and run the server:
cp .env.example .env
bundle
./init.sh
git clone https://github.com/icebaker/nano-bots-api.git
cd nano-bots-api
./build.sh
cp docker-compose.example.yml docker-compose.yml # Provide your credentials.
docker-compose up -d
# http://localhost:3048
Read the Ruby Nano Bots documentation to learn about security and privacy features.
We strongly recommend that you define a NANO_BOTS_ENCRYPTION_PASSWORD
to increase the security and privacy of your users.
The API ensures that Tools (Functions) run in sandboxed mode when the environment variable FORCE_SANDBOXED
is set to true
. You may set it to false
at your own risk. Learn more about what being sandboxed means in the Nano Bots specification.
Also, the API does not allow confirmable
tools; as per the current implementation, it would block requests without being able to collect a confirmation answer from users.
Verb | Path | Description |
---|---|---|
GET | / | Get the version. |
GET | /cartridges | Get all available cartridges. |
POST | /cartridges/source | Show the source code of a cartridge. |
POST | /cartridges | Evaluate the input. |
POST | /cartridges/stream | Create a stream to be pooled for a evaluation. |
GET | /cartridges/stream/:id | Get the current stream of a cartridge. |
POST /cartridges/source
{
"id": "-"
}
POST /cartridges
{
"cartridge": "-",
"state": "-",
"input": "hi"
}
POST /cartridges
{
"cartridge": {
"meta": {
"symbol": "🤖",
"name": "Nano Bot Name",
"author": "Your Name",
"version": "1.0.0",
"license": "CC0-1.0",
"description": "A helpful assistant."
},
"behaviors": {
"interaction": {
"directive": "You are a helpful assistant."
}
},
"interfaces": {
"repl": {
"prompt": [
{ "text": "🤖" },
{ "text": "> ", "color": "blue" }
]
}
},
"provider": {
"id": "openai",
"credentials": {
"access-token": "ENV/OPENAI_API_KEY"
},
"settings": {
"user": "ENV/NANO_BOTS_END_USER",
"model": "gpt-3.5-turbo"
}
}
},
"state": "-",
"input": "hi"
}
POST /cartridges
{
"as": "repl",
"action": "boot",
"cartridge": "-",
"state": "a21179b6104703af19328485101be839"
}
POST /cartridges
{
"as": "repl",
"action": "eval",
"cartridge": "-",
"state": "a21179b6104703af19328485101be839"
}
POST /cartridges
{
"as": "eval",
"action": "boot",
"cartridge": "-",
"state": "5677e56bbff1e8137c8eb1f60d2623ac"
}
POST /cartridges
{
"as": "eval",
"action": "eval",
"cartridge": "-",
"state": "5677e56bbff1e8137c8eb1f60d2623ac"
}
POST /cartridges/stream
The same payloads that were used for POST /cartridges
:
{
"cartridge": "-",
"state": "-",
"input": "hi"
}
Once you've installed the dependencies with bundle
, run Rubocop with the -A
flag for automatic fixes.
rubocop -A
If you face issues upgrading gem versions:
bundle install --full-index