DOCUMENTATION ยท v3.1

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:

ProviderEnv varProtocol
NVIDIA NIMNVIDIA_API_KEYOpenAI
Tencent TokenHubTOKENHUB_API_KEYOpenAI
DeepSeekDEEPSEEK_API_KEYOpenAI
Moonshot KimiMOONSHOT_API_KEYKimi
Meta LlamaMETA_API_KEYOpenAI
Alibaba DashScopeDASHSCOPE_API_KEYOpenAI
OpenAIOPENAI_API_KEYOpenAI
AWS BedrockAWS_PROFILEConverse
Ollama (local)OPSORA_OLLAMA_URLOpenAI

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:

Pages
npx wrangler pages deploy ./dist --project-name your-site
Workers + D1
npx wrangler deploy

Troubleshooting

Provider 401. Check the env var is set and the key is valid. Run opsora /status to confirm.
MCP won't connect. Confirm the binary is on PATH (Node.js โ‰ฅ 18 for npx) and that any required env tokens are populated.
Rate limit. Free tiers throttle. Switch to a paid key, or set OPSORA_PROVIDER_ORDER to rotate to a different provider.