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.0 — 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.0.tar.gz (16.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.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bee_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 16.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.0.tar.gz
Algorithm Hash digest
SHA256 e3e5de1b133130edb2a344e3d8af172e7bbdc161af13e2b9f7b4b2d75210f204
MD5 7cd85b422eeb5628e11630a0fe5e4ae6
BLAKE2b-256 da0afa1a8927c3a310275b08b77e6eba984164e7b20d6fac6faeb25bdd4c28a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bee_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bcf0b7ebe0e880741f82eeb35ab85c866103a24fc15d76f3dfe273ab6760799e
MD5 f290f1138a182da70bfa9c419c505d35
BLAKE2b-256 9c64a255d942290757ca1fb60a104590f4726ae899de5790d79d2633fad38678

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