billflare.

AetherGate: a self-hosted OpenAI-compatible gateway on Workers with per-member RPM, TPM and monthly budgets

haiying-ai/aethergate-ai-gateway is an MIT-licensed self-hosted OpenAI-compatible gateway that runs on Cloudflare Workers and D1. It routes one public model name to several upstream providers, issues hashed per-member sk- keys, and enforces RPM, TPM, concurrency and monthly budget policies, with a usage ledger and audit logs. This is an upstream-key control plane, not a substitute for Cloudflare’s own AI Gateway spend limits or account Spend Management.

Products
WorkersD1
Source
Community resourceGitHub repository
Author
haiying-ai

Key points

  • Quotas are described as hard constraints in a policy: request count, token count, concurrency, and max input/output per call. Each request writes a usage_ledger row with the upstream model, a price version, token counts, cost and settlement amount. Upstream keys are stored in D1 with AES-GCM.
  • The public API is OpenAI-compatible (/v1/chat/completions, /v1/responses, /v1/models, /v1/usage). An /admin console and /portal let operators and members manage keys and inspect usage. Pushed at 2026-11-13T02:47:09Z.

Original sources

  1. Last updated

    AetherGate: a self-hosted OpenAI-compatible gateway on Workers with per-member RPM, TPM and monthly budgets

    Open original source

    haiying-ai/aethergate-ai-gateway is an MIT-licensed self-hosted OpenAI-compatible gateway that runs on Cloudflare Workers and D1. It routes one public model name to several upstream providers, issues hashed per-member sk- keys, and enforces RPM, TPM, concurrency and monthly budget policies, with a usage ledger and audit logs. This is an upstream-key control plane, not a substitute for Cloudflare’s own AI Gateway spend limits or account Spend Management.

Author experienceContainers +1

Four months of CI on Cloudflare Containers: per-use vCPU billing and a hard cap that stopped CI

@kelvin_des describes moving all CI from GitHub Actions to one Cloudflare Container per job and puts the list-price bill for the same 90 days at about $1,608 versus $3,288–$6,502 for GitHub-hosted runners, because Containers bill vCPU on use and his boxes were about 41% busy. He also reports a ledger bug that made his own hard daily minute cap refuse every container, after which he bounds spend by max containers × per-job deadline.

Smart Shield Argo

v.kleinhenz: Argo costs jumped from $400 to $5,000 a month.

Community user v.kleinhenz says Argo costs for eurekamag.com rose from $400 a month to $5,000 a month, that he turned Argo off, and that Cloudflare does not protect against such a shock charge; in a follow-up he attributes it to bot traffic.

Author experienceD1 +4

qianshuixia2026: D1 free row-read cap burned twice in one day, plus R2 and Workers pitfalls after the first paid orders

浅水虾 (@qianshuixia2026) published a 16 November 2026 X article after the first $12 and $29 orders. On 14 November a 10-minute cron full-table scan burned the D1 Free 5 million daily row-read cap in 2 hours 14 minutes; the same evening the author ran wrangler d1 execute --remote statistics that scanned about 4.08 million rows in 5 minutes and hit the cap again, then paid $5 to upgrade to Workers Paid. The article also covers an R2 multipart complete() customMetadata mismatch that failed a >24 MB export five times (50 credits sent as apology), 128 MB / 10 ms / 50-subrequest walls that a paid plan does not lift, and Queues’ 10,000 daily operations with three operations per delivered message.