Build with Opsora
Opsora is a multi-provider AI agent with a routing engine, MCP fleet, plugin system, and autonomous orchestration. This guide walks you through installation, configuration, and the HTTP API.
Quick start
Install the CLI, set one provider key, and route your first task in under a minute:
$ pip install opsora-cli
$ export NVIDIA_API_KEY=nvapi-...
$ opsora "explain this Python function"
The router classifies the intent (analysis), picks a reasoning model from your available providers, streams a response, and logs the cost.
Install
From PyPI
pip install opsora-cli
opsora --version
From source
git clone https://github.com/opsora/opsora-cli.git
cd opsora-cli && pip install -e ".[dev]"
Providers
Opsora speaks OpenAI-compatible, AWS Converse, and Kimi protocols. Bring any combination of keys:
| Provider | Env var | Protocol |
|---|---|---|
| NVIDIA NIM | NVIDIA_API_KEY | OpenAI |
| Tencent TokenHub | TOKENHUB_API_KEY | OpenAI |
| DeepSeek | DEEPSEEK_API_KEY | OpenAI |
| Moonshot Kimi | MOONSHOT_API_KEY | Kimi |
| Meta Llama | META_API_KEY | OpenAI |
| Alibaba DashScope | DASHSCOPE_API_KEY | OpenAI |
| OpenAI | OPENAI_API_KEY | OpenAI |
| AWS Bedrock | AWS_PROFILE | Converse |
| Ollama (local) | OPSORA_OLLAMA_URL | OpenAI |
Set the priority order so the router knows which provider to try first:
export OPSORA_PROVIDER_ORDER=nvidia,tokenhub,deepseek,moonshot,meta
MCP servers
Edit ~/.opsora/mcp.json to wire external tools via the Model Context Protocol:
{
"mcpServers": {
"github": {"command": "npx", "args": ["-y","@modelcontextprotocol/server-github"], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_MCP_TOKEN}"}},
"supabase": {"command": "npx", "args": ["-y","@supabase/mcp-server"], "env": {"SUPABASE_ACCESS_TOKEN": "${SUPABASE_MCP_TOKEN}"}},
"gmail": {"command": "npx", "args": ["-y","@gmail-mcp/server"], "env": {"GMAIL_OAUTH_TOKEN": "${GMAIL_MCP_TOKEN}"}},
"filesystem":{"command": "npx", "args": ["-y","@modelcontextprotocol/server-filesystem","/root"]},
"sqlite": {"command": "npx", "args": ["-y","@modelcontextprotocol/server-sqlite","/root/.opsora/memory.db"]}
}
}
Connect them at runtime with /mcp-connect or let Opsora auto-connect on startup.
Environment
Secrets live in ~/.opsora_env (gitignored). Opsora loads this file before initializing providers and MCP servers.
POST /chat
POST /api/chat โ proxy a prompt through the router.
curl -X POST https://opsora-agent.pages.dev/api/chat \
-H "Content-Type: application/json" \
-d '{"prompt":"refactor auth.py to use JWT","prefer_cost":true}'
Returns the chosen provider/model and the assistant reply.
GET /status
GET /api/status โ live health of every provider and MCP server.
{
"providers": {"nvidia": "ok", "tokenhub": "ok", "deepseek": "ok"},
"mcp": {"github": "connected", "filesystem": "connected"}
}
GET /cost
GET /api/cost โ aggregated spend, grouped by model.
POST /agent
POST /api/agent โ kick off the autonomous agent on a multi-step task. Streams progress events.
Autonomous agent
Planner โ reasoning model. Explorer โ fast secondary model. Verifier โ reasoning model. The agent decomposes your request into 2โ8 subtasks, executes each in a ReAct loop, and verifies completion before reporting.
Sub-agent orchestrator
Spawn parallel sub-agents for research, file analysis, or boilerplate generation. Up to 3 concurrent by default; configurable via max_parallel.
Plugins
Drop a Python file in ~/.opsora/plugins/ that subclasses OpsoraPlugin. Opsora auto-discovers it at startup.
Skills
Skills are higher-level workflows (problem solver, code reviewer, deployer) that the agent can invoke. Register a skill by adding it to the skill registry and pointing at its description.
Deploy
The Opsora website (this site) is hosted on Cloudflare Pages with a Workers + D1 backend. To deploy your own instance:
npx wrangler pages deploy ./dist --project-name your-sitenpx wrangler deployTroubleshooting
opsora /status to confirm.npx) and that any required env tokens are populated.OPSORA_PROVIDER_ORDER to rotate to a different provider.