Skip to main content

Official Python client + MCP server for the Bee Intelligence Engine — domain-specialized LoRA-routed LLM by CUI Labs.

Project description

bee-sdk

Official Python client + MCP server for the Bee Intelligence Engine — a domain-specialized LLM by CUI Labs routing per-domain LoRA adapters over a verified open-weight base.

SDK version: 0.3.2 — adds per-call/BEE_MODEL model-tier selection (bee-cell … bee-swarm; access follows your key's plan) and MCP tool annotations.

Includes a hosted Model Context Protocol server: pip install bee-sdk then run bee-mcp (stdio) to expose Bee's 11 domain tools to Claude Desktop, Cursor, VS Code, Zed, and Windsurf. See bee.cuilabs.io/docs/mcp.

Status: functional sync + async client (stdlib + optional httpx). The SDK targets the Bee /chat/completions API contract on production via the public gateway https://bee.cuilabs.io/bee — this is the default and it is where API-key auth, plan / per-tier allowance enforcement and usage metering happen. Do not point BEE_API_URL at the raw Modal app URL: that bypasses billing and a bee_sk_ key is rejected there (the backend only trusts Supabase JWTs / the static BEE_API_KEYS env, not customer-issued keys). Override BEE_API_URL only for a self-hosted Bee Enclave or staging.

Install

Install from PyPI (canonical):

pip install bee-sdk          # sync client (stdlib only — zero deps)
pip install bee-sdk[async]   # async client (adds httpx)

Install + quickstart on the marketing site: bee.cuilabs.io/docs/sdks.

Quick start

from bee_sdk import Bee

bee = Bee()  # reads BEE_API_URL + BEE_API_KEY from env
print(bee.chat("Explain Shor's algorithm at NISQ depth", domain="quantum"))

Streaming

for chunk in bee.chat_stream("Write a Rust fibonacci function", domain="programming"):
    print(chunk, end="", flush=True)

Async

import asyncio
from bee_sdk import AsyncBee

async def main():
    client = AsyncBee()
    text = await client.chat("Audit this contract for re-entrancy", domain="blockchain")
    print(text)

asyncio.run(main())

Multi-turn

from bee_sdk import Bee, ChatMessage

bee = Bee()
resp = bee.chat_messages(
    [
        ChatMessage(role="system", content="You are a senior security auditor."),
        ChatMessage(role="user", content="Review this nginx config for hardening gaps:\n\n..."),
    ],
    domain="cybersecurity",
    max_tokens=1024,
)
print(resp.content)
print(resp.usage, resp.interaction_id)

Feedback loop

resp = bee.chat_messages([...], domain="ai")
if user_likes_answer:
    bee.feedback(resp.interaction_id, rating="up")

Domains

The domain= parameter selects which LoRA adapter Bee routes through. Tier-1 domains:

domain what it's tuned for
general balanced, no specialization
programming code generation, refactoring, debugging
ai ML/AI papers, training, evaluation
cybersecurity threat modelling, audits, defensive analysis
quantum NISQ-aware quantum computing, Qiskit
fintech payments, risk, compliance
blockchain smart contract audits, protocol design
infrastructure systems, networking, devops
research literature review, paper critique
business strategy, GTM, ops

Adapters live at cuilabs/bee-cell on branches <domain>-<UTC-timestamp>.

Environment variables

var purpose
BEE_API_URL Endpoint override. Defaults to the public gateway https://bee.cuilabs.io/bee (where auth + billing + metering run). Set this only for a self-hosted Bee Enclave or a staging environment — never the raw Modal app URL (that bypasses billing and rejects bee_sk_ keys).
BEE_API_KEY Bearer token (also accepts BEE_PORTAL_API_KEY)

Errors

from bee_sdk import BeeAPIError, RateLimitError, BeeError

try:
    bee.chat("...", domain="quantum")
except RateLimitError as e:        # 429 after retries
    ...
except BeeAPIError as e:           # other HTTP errors
    print(e.status, e.body)
except BeeError:                   # network / timeout
    ...

The sync client retries 429/5xx with exponential backoff (max 4 attempts).

Versioning

bee-sdk follows the Bee API surface in bee/server.py. Breaking API changes bump the minor version pre-1.0; the SDK is currently 0.1.1 and the API is v1.

License

Apache-2.0 © 2026 CUI Labs (Pte.) Ltd.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bee_sdk-0.3.2.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bee_sdk-0.3.2-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file bee_sdk-0.3.2.tar.gz.

File metadata

  • Download URL: bee_sdk-0.3.2.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bee_sdk-0.3.2.tar.gz
Algorithm Hash digest
SHA256 9f0d762ffdbf3af1341810b1663c699ed4c697de109ca9ff91c420ed568679da
MD5 8df5f1f62774685f7cbf68fc357a6464
BLAKE2b-256 21e2076508eaf5e3f7e81e62e86bfbc19203a7841a12a7b71e0183853a4bfa94

See more details on using hashes here.

File details

Details for the file bee_sdk-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: bee_sdk-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bee_sdk-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c124f17e61c60d2e991d7a5e9fb08e444f24a800b12f41d7d02df3772ddf7c5
MD5 fbc451af9458dd631927a795fb318917
BLAKE2b-256 648f621eaa8e29c17150275c4d28afaa06909f38015fac54a7b75c4ee8f10d32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page