Shared Pools, Individual Limits: How Pinterest Budgets AI Tools
Pinterest replaced per-engineer AI tool budgets with shared team pools, each owned by a director or VP, plus individual guardrails that cap how much one person can draw over a rolling 28-day window. Earlier versions used request-count quotas in an egress proxy, then reserved dollar budgets per engineer, which wasted unused money and created constant manager reassignment work. In the current design, a model gateway prices each request from token usage and checks a spend authorization service before admitting it. The service fails open, tolerates small in-flight overruns rather than reserving per request, and offers audited 24-hour emergency access. Requests to raise individual budgets fell 85% during the rollout.
Related posts
- Introducing Spend Management: Spending limits and alerts for Cloudflare
Cloudflare mediumAdeptCloudflare Spend Management, now in beta for pay-as-you-go customers, lets users set spending limits and alert thresholds on Workers and Durable Objects, automatically pausing billable invocations when a cap is hit. Static assets keep serving. Limits can be configured via dashboard, cf CLI or REST API. Under the hood, a two-stage metering pipeline aggregates usage into one-minute and then five-minute windows, and an account-partitioned Usage Engine with local state and a WAL feeds a Rating Engine. The Rating Engine applies allowances and pricing, tolerating out-of-order subscription data by holding usage as pending. Caps propagate asynchronously through Quicksilver so enforcement uses local state off the request path, with roughly 10-minute lag today and a goal of under a minute.
- Controlling costs when building with AI
incident.io mediumAdeptAfter hitting OpenAI billing limits broke its early AI features, incident.io built per-prompt cost attribution into its Go LLM abstraction, using reflection to capture each prompt's type name alongside token usage and emitting it to Grafana metrics and Postgres records for BI. Separate OpenAI projects per feature, mapped from source file patterns and provisioned with Terraform, give each surface its own billing limit to contain runaway spend. Daily Slack spend reports, per-message cost and latency in dev, backfill cost predictions from historical runs, and eval suites that report their cost keep spend visible to developers and let teams model feature costs before launch.
- A sandbox doesn't constrain an API Key: What Polsia learned running autonomous companies on Render
Render easyNovice
Polsia, a solo-built platform where AI agents run businesses (outreach, ads, support, engineering) on nightly loops, shared production lessons in a talk at Render's localhost event. Sandboxing an agent does not narrow its credentials: a Postmark key meant for sending email let an agent rename the main server and change webhooks, so keys must be scoped to the task. Open-ended agent loops sometimes stopped before committing or deploying, so Polsia made those steps deterministic checkpoints and left model judgment for ambiguous work. After roughly $2M monthly Anthropic bills, it also routed routine steps to cheaper models and standardized on a stack of Render, GitHub, Neon and MCP tools.
- Beyond rate limits: scaling access to Codex and Sora
OpenAI mediumAdept
OpenAI replaced hard rate-limit stops for Codex and Sora with a real-time access engine that treats rate limits, free tiers, credits, promotions and enterprise entitlements as layers in a single decision waterfall evaluated per request. Rate limits are consumed synchronously, and credits are checked in the same request but debited asynchronously through a streaming processor. Three chained datasets (product usage events, monetization events, balance updates) make every outcome auditable and replayable. Idempotency keys prevent double-debits, per-account serialized atomic transactions pair each balance decrement with an attributed record, and brief overshoots from the async delay are automatically refunded, trading strict enforcement for provable correctness.
- Scaling Model Evaluation at Pinterest with Ray (Part 4)
Pinterest Engineering mediumAdeptPinterest fused model-evaluation metric computation into its Ray batch inference jobs, removing the separate Spark/Ray metrics job and the write-predictions-to-S3-then-reread handoff. The fusion relies on a metric contract (preprocess, compute partials per batch, reduce partials) that covers decomposable metrics like MAE, holistic metrics like ROC-AUC (approximated via per-threshold confusion matrices), and group-wise metrics like Precision@K. Group-wise metrics use Spark to pack complete segments into buckets so no segment spans a bucket. Overlapping CPU metric work with GPU inference via Ray's shared object store cut end-to-end evaluation time by 25–32% at 100 feature-importance experiments, with runtime scaling linearly in experiment count.