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 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.1.1 (pre-release).

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.2.0.tar.gz (15.1 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.2.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bee_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 15.1 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.2.0.tar.gz
Algorithm Hash digest
SHA256 1b57fdccf1529711456b47a49de6dad8baa74158827257d076c70d4b7ccc8671
MD5 b98623dd9f9a3da7ba25fc93a0b97b9d
BLAKE2b-256 e66ab05b4aa9e34973a4f5cfe10d7f8f6fd71eb56123f9182d3e97bdb8317b88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bee_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2832830e4ddec664dac8e0c8b45fd4c1a8ae28f2098ffaa5fc53ac6e7f11a270
MD5 db04057456ffcbda914184ca22b7a93f
BLAKE2b-256 9041658487e8355b3f534ddbf24f399fde7c69355d9fd264b7adf220955332ff

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