docs/guides/openai-compatible-agent-api.md
nanobot can expose a local OpenAI-compatible endpoint behind
/v1/chat/completions. This lets existing OpenAI-style clients talk to a
tool-using nanobot agent instead of a raw model.
127.0.0.1:8900/v1/chat/completions requestsession_idUse this when an existing client, another language, or a separate process already knows how to call an OpenAI-compatible API. Use the Python SDK when you want in-process access to sessions, memory, runtime helpers, and hooks.
python -m pip install nanobot-ai
nanobot plugins enable api
nanobot onboard --wizard
nanobot agent -m "Hello!"
Start the API server:
nanobot serve
Call the chat endpoint:
curl http://127.0.0.1:8900/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "hi"}],
"session_id": "demo"
}'
session_id to isolate users, jobs, or workflows.stream is true./v1/models reports the fixed model surface expected by compatible clients.127.0.0.1 usage does not require an API key.api.host is 0.0.0.0 or ::, configure api.apiKey before startup./v1/chat/completions fails, test nanobot agent -m "Hello!" first.api.host, api.port, firewall, and
API key configuration.session_id values.