A pooled inference gateway on Cloudflare. A member gets a virtual key with a monthly dollar cap; the key works in a plain chat box on this page, in any OpenAI-compatible app, and in Claude Code. The group pays one provider bill at list price. The organizers see spend per person and per model.
bac_live_….Paste a key once, pick a model, chat. Streams. Spend meter updates after each reply.
POST /api/v1/chat/completions and GET /api/v1/models. Works with the openai SDK by changing base_url.
POST /api/v1/messages. Set ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY to your commons key.
Members text the bot; Opus plans, Sonnet/Haiku build; files deploy to their own .pages.dev after your approval. Private homepage per member; overwatch page for organizers.
Create members, set tier and budget, issue or revoke keys, see spend by member, model and day. Shared admin secret for the POC; real login is the next step.
Prices are the providers' published list prices on 2026-10-23 (Workers AI from Cloudflare's models API; OpenAI and Anthropic from their pricing pages). The gateway adds no markup; Unified Billing adds 5% on credit top-ups if the group pays Cloudflare instead of each provider. Usage assumptions are illustrative, not measured.
| Model | Tier | $ / M input | $ / M output | A "heavy chatter" month* | A Claude Code day** |
|---|---|---|---|---|---|
Loading from /api/v1/models… | |||||
* 300 messages, 1,500 input + 400 output tokens each = 450k in / 120k out. ** 40 agentic turns, 25k input + 1.5k output each = 1.0M in / 60k out. Shown for every model as a like-for-like token cost; only the Anthropic rows actually work in Claude Code today. No prompt caching counted; with caching, repeated-context input cost drops roughly 5x.
Workers AI only: Llama 3.3 70B, gpt-oss-120b, Qwen coder. $5 buys about 2.5M output tokens on Llama 70B. Most people never hit it.
Adds GPT-5 mini, Claude Haiku 4.5 and Sonnet 4.5 for Claude Code. Cap is per person, enforced before each call, resets on the 1st.
"Ask" on the org site queuing on one person's consumer plan. A consumer subscription is for one human; serving a group through it is outside its terms and does not scale. Per-member API keys at list price fix both.
Enter a commons key. Keys are issued by an organizer; this page never stores the pooled upstream key. The key you paste stays in this browser tab only.
from openai import OpenAI
c = OpenAI(base_url="/api/v1", api_key="bac_live_…")
r = c.chat.completions.create(model="llama-3.3-70b",
messages=[{"role":"user","content":"hi"}])
print(r.choices[0].message.content)export ANTHROPIC_BASE_URL=/api/v1 export ANTHROPIC_API_KEY=bac_live_… export ANTHROPIC_MODEL=claude-sonnet-4-5 claude
Note: Claude Code calls /v1/messages; this POC forwards that shape. Tool-use streaming was spot-tested with curl, not with a full Claude Code session yet.
curl /api/v1/chat/completions \
-H "Authorization: Bearer bac_live_…" \
-H "content-type: application/json" \
-d '{"model":"llama-3.1-8b","messages":[{"role":"user","content":"hi"}]}'Needs the admin secret. Members never see this.
| Real now | Not yet |
|---|---|
| Per-member keys (hashed at rest), monthly caps enforced before every call, 30 req/min per key, token metering from provider usage blocks, cost in integer microcents, streaming on both API shapes, model allowlist by tier, admin create/update/revoke/usage, this chat. Build agent (Worker + Durable Object per member): Telegram bot with invite codes, Opus 5.5 routes each request to Haiku or Sonnet, tools write files to D1, deploy to a per-member Pages project (direct upload, no wrangler), and create a private GitHub repo. First deploy and repo creation wait in an organizer approval queue (Telegram reply or the overwatch page). Each member has a private homepage with history, projects, saved code and spend. Tested end to end: a one-page site was built, approved and served live. |
Real organizer login (shared secret only). Member self-service signup. Prompt-cache accounting for Anthropic (counted as input). Monthly email of spend. Rotation of the pooled key. Abuse review of prompts. SMS surface (A2P registration). Agent cannot run code or fetch the web yet; it writes static files. Telegram bot token not yet created, so the bot is unlinked until BotFather is done. |