Billama 3.0 System Architecture & Developer Guide
Billama 3.0 is an enterprise-grade decentralized GPU marketplace and token utility grid. Featuring an intelligent multi-tier dual-router, it dynamically matches prompts to optimal model tiers while guaranteeing continuous hardware yield through the Zero-Idle Waterfall.
https://api.billama.netBearer blm_live_...82% Net Revenue2. Official TypeScript SDK (@billama/sdk)
The official TypeScript/JavaScript library for full-stack applications. Includes streaming chat completions, billing checkout sessions, micro-metered job dispatching (RenderGrid Blender 3D, 4-stem Demucs separation), Next.js App Router balance guards, and React hooks.
// 1. Installation
pnpm add @billama/sdk
// 2. Client Initialization & Streaming Chat
import { Billama } from "@billama/sdk";
const billama = new Billama({
apiKey: process.env.BILLAMA_API_KEY,
});
const stream = await billama.chat.stream({
model: "llama3.3:70b",
messages: [{ role: "user", content: "Optimize our data pipeline." }],
});
for await (const chunk of stream) {
process.stdout.write(chunk.content);
}
// Access diagnostic routing telemetry:
console.log({
tokens: stream.usage?.totalTokens,
latencyMs: stream.latencyMs,
costUsd: stream.costUsd,
routerTarget: stream.routeTarget
});
// 3. User Wallet Balance Check & Subscriptions
const balance = await billama.billing.getBalance();
console.log("Credits remaining: $", balance.balanceUsd);
const session = await billama.billing.createCheckoutSession({
planId: "pro_monthly",
customerEmail: "user@domain.com",
successUrl: "https://app.domain.com/settings/billing?success=true",
cancelUrl: "https://app.domain.com/pricing",
});3. OpenAI SDK Drop-In
Any application utilizing the official OpenAI client in Python, TypeScript, Go, or Rust can route traffic through Billama by configuring the base_url.
from openai import OpenAI
client = OpenAI(
base_url="https://api.billama.net/v1",
api_key="blm_live_your_key_here"
)
response = client.chat.completions.create(
model="llama3.3:70b",
messages=[
{"role": "system", "content": "You are a specialized AI assistant."},
{"role": "user", "content": "Generate a high-concurrency token router."}
],
temperature=0.6,
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)4. Native Ollama API
Billama natively proxies Ollama API endpoints, preserving the exact JSON response structures including token counts (prompt_eval_count and eval_count).
# 1. Chat completions
curl https://api.billama.net/api/chat \
-H "Authorization: Bearer blm_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-r1:70b",
"messages": [{"role": "user", "content": "Optimize PostgreSQL connection pooling."}],
"stream": true
}'
# 2. Text generation
curl https://api.billama.net/api/generate \
-H "Authorization: Bearer blm_live_your_key_here" \
-d '{"model": "llama3.2:8b", "prompt": "Summarize the Billama whitepaper."}'
# 3. Model list
curl https://api.billama.net/api/tags \
-H "Authorization: Bearer blm_live_your_key_here"5. Worker Node Daemon Setup
Hardware owners run the lightweight non-root node runner. The runner automatically detects NVIDIA CUDA, AMD ROCm, or Apple Metal hardware and dynamically allocates models to VRAM.
# Step 1: Install daemon via 1-liner curl -sSL https://billama.net/install.sh | sh # Step 2: Start worker with your node token billama-node start \ --server=https://api.billama.net \ --token=blm_node_your_node_token \ --max-vram=22GB \ --zero-idle=true # Supported CLI flags: # --server URL of Billama Gateway # --token Node authentication secret (from dashboard) # --max-vram VRAM cap to reserve for Billama workloads # --zero-idle Enable automatic cascade to Tier 2/3 jobs when idle # --port Local Ollama port (default: 11434)
6. The Zero-Idle Waterfall™
The Zero-Idle Waterfall ensures no hardware sits idle. Whenever real-time inference traffic drops, the node manager switches tasks in under 100 milliseconds:
7. RenderGrid & Universal Batch Compute
Billama includes a distributed 3D rendering engine. Headless Blender scenes are sliced into tile coordinates and dispatched across active nodes. Output frames are cryptographically verified using sha256 tile hashes to eliminate bad renders.
# Submit 3D rendering batch job via REST
curl -X POST https://api.billama.net/v1/jobs/submit \
-H "Authorization: Bearer blm_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"type": "blender_render",
"scene_url": "https://assets.billama.net/scenes/demo.blend",
"resolution": [3840, 2160],
"samples": 512,
"tile_grid": [4, 4]
}'8. Enterprise FreeIPA & LDAP Setup
Billama provides in-cluster FreeIPA integration with automated user seeding and group mapping. Configure your LDAP binding in Helm or environment variables:
# Environment Variables for LDAP Integration:
LDAP_URL="ldap://freeipa.freeipa.svc.cluster.local:389"
LDAP_BIND_DN="uid=admin,cn=users,cn=accounts,dc=billama,dc=local"
LDAP_BIND_PASSWORD="AdminPassword123!"
LDAP_SEARCH_BASE="dc=billama,dc=local"
LDAP_USER_SEARCH_FILTER="(&(objectClass=person)(|(uid={{username}})(mail={{username}})))"
LDAP_GROUP_SEARCH_FILTER="(member={{dn}})"9. Kubernetes Helm Deployment
Deploy Billama in private enterprise clusters using the production Helm chart.
helm repo add billama https://charts.billama.net helm upgrade --install billama billama/billama \ --namespace billama \ --create-namespace \ --values values-production.yaml
10. Payouts & Provider Economics
Hardware nodes receive an 82% net payout. Settlements occur weekly with support for Stripe Connect bank ACH, USDC on Solana or Polygon, or 0%-fee Billama compute credits.
11. Intelligent Multi-Tier Model Cascading & Edge Routing
Billama 3.0 decouples routing decisions from transport proxying by pairing two specialized engines:
Analyzes prompt complexity, agent intent, and quality feedback to pick the optimal model tier (cascading simple queries to lightweight 3B models and escalating complex reasoning to frontier 70B models), saving an extra 40–70% in token costs.
Ultra-low latency token router with <100µs overhead. Handles adaptive least-latency load balancing, real-time health telemetry, cluster mesh routing, and guardrail interception across thousands of warm GPU nodes.
Dual-Routing Modes Matrix
| Mode | Decision Layer (Cascading) | Edge Transport (<100µs) | Behavior |
|---|---|---|---|
| HYBRID_CASCADE | Active (Cascading) | Active (<100µs LB) | Default dual-engine mode: intelligent model choice + ultra-low latency edge proxy |
| TIER_LOCKED | Explicit Model Tier | Active (<100µs LB) | Direct tier mode: user-specified model with adaptive edge load balancing |
| EDGE_PROXY | Pass-Through | Active (<100µs LB) | Transport-only mode: high-throughput routing without dynamic model cascading |
| DIRECT_NODE | Disabled | Disabled | Direct session to decentralized P2P warm worker nodes or local daemon |
Response Telemetry Headers
Every response through Billama 3.0 includes diagnostic telemetry headers so developers can monitor model overrides, routing confidence, and verified cost savings:
HTTP/1.1 200 OK X-Billama-Route-Target: HYBRID_CASCADE X-Billama-Router-Engine: Adaptive Multi-Tier Engine X-Billama-Selected-Model: llama3.2:3b X-Billama-Original-Model: llama3.3:70b X-Billama-Routing-Strategy: cascade X-Billama-Routing-Confidence: 0.94 X-Billama-Routing-Cost-Savings: 85% X-Billama-Node-Id: edge-adaptive-lb-pod-2
12. Ecosystem Applications Architecture
Five commercial ventures leverage Billama as their unified AI compute layer and billing clearinghouse:
Browser-based Google Magenta JS generates dynamic MIDI melodies and chords, while heavy GPU Demucs 4-stem separation jobs run over Billama RenderGrid.
pnpm add @magenta/music @billama/sdkDiscovers funding opportunities and drafts federal proposals using Billama vector embeddings for RAG and Llama 3.3 70B narrative generation.
billama.embeddings.create() + billama.chat.stream()AI metabolic copilot evaluates patient vitals and workouts with pre-flight subscription balance guards ensuring compliance before model inference.
billama.billing.getBalance() > 0NVIDIA Jetson IoT devices stream zero-idle anomaly inference, offloading heavy multi-camera vision batches to Billama GPU clusters during off-peak windows.
billama.jobs.createBatch({ type: "VISION_INFERENCE" })On-premise Frigate NVR and ZoneMinder streams route backyard chicken coop camera frames to Billama vision models (llama3.2-vision, qwen2.5-vl) for real-time predator threat classification and coop defense triggers.
billama.chat.completions.create({ model: "llama3.2-vision:11b" })