๐ง Buni
The open-core hybrid edge-cloud framework for high-stakes, cryptographically grounded AI agents.
Quickstart โข Architecture โข MCP Integration โข Documentation โข Buni Cloud
๐ก What is Buni?
Buni is a local-first CLI, gateway daemon, and MCP server that allows developers to build AI agents for industries where hallucinations and unverified outputs are unacceptable (healthcare, legal, finance, and enterprise compliance).
It acts as an intelligent hybrid router: routine, low-risk requests execute locally on your machine via Ollama ($0 COGS, zero network latency), while high-complexity or high-risk queries automatically escalate to the hosted buni_cognitive Cloud Engine for verifiable RAG grounding, deterministic safety scoring, and model arbitrage.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ LOCAL DEVELOPER ENVIRONMENT โ
โ Your App / Cursor / Claude Desktop โ
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ buni-cli Daemon (localhost:8000) โ
โ - Local ETAT+ Safety Evaluator โ
โ - Confidence Score Check (โฅ0.85) โ
โโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
โ Routine / Low-Risk โ High-Risk / Low Confidence
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Tier 1: Local Ollama โ โ Tier 2: Buni Cloud โ
โ (llama3.2, qwen2.5) โ โ (buni_cognitive Engine) โ
โ - $0 COGS / 0ms Net โ โ - Global pgvector RAG โ
โ - 100% Private โ โ - Cryptographic SHA-256 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ - Gemini Flash / GPT-4.1 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฅ Key Features
- ๐๏ธ Local-First Hybrid Cascading: Run routine prompts locally via Ollama or LM Studio. Only pay for cloud compute when queries breach your risk or uncertainty thresholds.
- ๐ก๏ธ Deterministic Safety Fallbacks: Python-enforced rule evaluation prevents critical edge cases from relying purely on LLM guesswork.
- ๐ Cryptographic Truth (
dataset_hash): Cloud completions attach an immutable SHA-256 fingerprint proving the exact vector snapshot used during RAG generation. - ๐ Native MCP Server: Plugs directly into Claude Desktop, Cursor, or autonomous agents to expose standardized risk-scoring and grounded RAG tools.
- โก Dynamic COGS Arbitrage: Cloud requests automatically route low-risk queries to low-cost models (Gemini Flash at ~$0.0015/req) and escalate high-risk cases to GPT-4.1.
- ๐ณ Dual-Rail Billing Ready: Built-in credit check proxy supporting prepaid local rails (M-Pesa, Paystack) and post-paid global rails (Metronome, Stripe, x402).
๐ Quickstart in 60 Seconds
1. Install via PyPI
pip install buni-cli
2. Initialize and Probe Local Models
Run buni init in your project directory. Buni will automatically scan your machine for running local LLM providers (e.g., Ollama at http://localhost:11434):
$ buni init
[Buni] Probing local environment...
[Buni] โ Apple Silicon M-Series GPU detected.
[Buni] โ Local Ollama instance found at http://localhost:11434.
Available local models:
1) llama3.2:3b (Installed - Recommended for local triage)
2) qwen2.5-coder:7b (Installed)
3) Custom Endpoint...
4) None (Cloud-Only Route)
Select primary local model [1-4]: 1
[Buni] Created buni.yaml successfully!
3. Start the Local Gateway Daemon
buni serve --port 8000
Your local daemon is now listening on http://localhost:8000/v1/chat/completions with full OpenAI API parity.
๐ป Code Example
You can point any standard OpenAI SDK directly to your local Buni daemon:
from openai import OpenAI
# Point your client to the local Buni daemon
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="buni_cloud_key_optional_for_local"
)
response = client.chat.completions.create(
model="buni-auto", # Buni automatically routes local vs cloud
messages=[
{"role": "user", "content": "Patient reports mild headache for 2 hours."}
]
)
# Standard completion content
print(response.choices[0].message.content)
# Access Buni cryptographic metadata
x_buni = response.model_extra.get("x_buni", {})
print(f"Routed Tier: {x_buni.get('routed_tier')}") # 'local' or 'cloud'
print(f"Dataset Hash: {x_buni.get('dataset_hash')}") # SHA-256 RAG proof
๐ MCP Server Support (Claude & Cursor)
Buni includes a native Model Context Protocol (MCP) server so your AI coding assistants and autonomous agents can invoke grounded reasoning tools.
Cursor / Claude Desktop Configuration
Add Buni to your claude_desktop_config.json or Cursor MCP settings:
{
"mcpServers": {
"buni": {
"command": "buni",
"args": ["mcp", "serve"],
"env": {
"BUNI_API_KEY": "buni_cloud_sk_..."
}
}
}
}
Available MCP Tools
evaluate_risk: Analyzes input text against deterministic rules engines and outputs a severity score (1โ5).execute_grounded_query: Performs full vector RAG search and generates an answer backed by a cryptographicdataset_hash.
โ๏ธ Configuration (buni.yaml)
Control your edge-to-cloud escalation limits directly in buni.yaml:
version: "1.0"
# Local Edge Provider
local:
provider: ollama
endpoint: "http://localhost:11434"
model: "llama3.2:3b"
confidence_threshold: 0.85 # Escalate to cloud if local logprobs < 0.85
# Cloud Escalation Settings
cloud:
api_key: "${BUNI_API_KEY}"
endpoint: "https://api.buni.health/v1/cognitive/execute"
auto_escalate_severity: 3 # Always send Severity >= 3 to cloud
verify_rag_hash: true
๐ Local vs Cloud Decision Matrix
| Metric / Gate | Local Execution (Ollama) |
Cloud Execution (buni_cognitive) |
|---|---|---|
| Severity Score | Severity 1โ2 (Routine, simple prompts) | Severity 3โ5 (High risk, critical alerts) |
| Model Confidence | Local logprobs >= 0.85 | Local logprobs < 0.85 |
| RAG Requirement | Local cached knowledge base | Global verified dataset with SHA-256 proof |
| Latency & Cost | < 50ms / $0.00 COGS | Sub-700ms P95 / Billed via Cloud Credits |
๐ Community & Commercial Ecosystem
- Open-Core Engine: The
buni-cligateway, local Ollama router, and MCP server are 100% free and open source under the Apache 2.0 License. - Buni Cloud (Managed Platform): Sign up at buni.health for managed vector index hosting, international Metronome/Stripe billing, M-Pesa local pre-paid developer wallets, and 99.99% cloud uptime SLAs.
๐ License
Distributed under the Apache License 2.0. See LICENSE for more information.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file buni_cli-0.1.3.tar.gz.
File metadata
- Download URL: buni_cli-0.1.3.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.14.4 Linux/7.0.0-30-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b39667c4a1d3201722440db4d071935f7279871fdbefc79de41d3faccfaaf331
|
|
| MD5 |
7a406972fd3dcf3d85fce8add96a0d59
|
|
| BLAKE2b-256 |
01fef0acbe05c1df08abe4838162e92571ef62cb1fbd77186c8e10e7a79b0b9a
|
File details
Details for the file buni_cli-0.1.3-py3-none-any.whl.
File metadata
- Download URL: buni_cli-0.1.3-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.14.4 Linux/7.0.0-30-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83c0907f2a843e3ca7fcd8199b41fea5219145c4ef28b6c832be84109dcdc7d8
|
|
| MD5 |
fce764da6077127076ddae5c07274a68
|
|
| BLAKE2b-256 |
8b1320792a10378178543af5c053cd8b0f6cb2228e88f3d20de70e970f32e2ec
|