Skip to main content

Official Python client 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

The PyPI cuilabs organisation is currently pending approval; until it lands, install directly from GitHub:

# From GitHub (recommended while PyPI approval is pending)
pip install "git+https://github.com/cuilabs/bee.git#subdirectory=sdks/python"

# With the optional async client (adds httpx)
pip install "git+https://github.com/cuilabs/bee.git#subdirectory=sdks/python" httpx

Once PyPI approval lands, the canonical install is:

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.1.1.tar.gz (9.3 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.1.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bee_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for bee_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9f89c7102e685111725e0b23bb192b51ec3ec0f438113fa53abd9586da7e3829
MD5 da85fb588242612407928a06ff9177de
BLAKE2b-256 3fdf882a10c3a990904afdb792bb3892b43ec7c31a6888a026a71fe94fe0bcbd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bee_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for bee_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0ede80aa475f3aff9f6f1444410b929fe63cffac47afc125131efe866297a164
MD5 b892686576426a0b7af2d0b3f25d75c3
BLAKE2b-256 1ff727cf6b31d9ef24cd8d39803d7081c7918a958f60edb9bc6771daef301efc

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