Skip to content

[fix] Raise the free-credits per-key tpm cap to 1,000,000 - #6363

Merged
mmabrouk merged 1 commit into
release/v0.114.4from
fix/starter-credits-tpm-cap
Aug 31, 2026
Merged

[fix] Raise the free-credits per-key tpm cap to 1,000,000#6363
mmabrouk merged 1 commit into
release/v0.114.4from
fix/starter-credits-tpm-cap

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

The free-credits proxy refused 12 calls in 72 hours on EU cloud with "Rate limit exceeded ... Limit type: tokens. Current limit: 200000", including 4 in a row for one account. Every free-credits key is minted with a 200,000 tokens-per-minute cap, and a single Gemini Flash turn can carry close to its 1M-token context, so ordinary first-run use trips the cap. The user sees a failed run.

Changes

The per-key cap becomes 1,000,000 tokens per minute. The $5 key budget and the 30 requests-per-minute limit stay as the real bounds on spend and rate.

This PR carries the agenta side: DEVELOPMENT_POLICY_VALUES (the policy a deployment without PostHog runs on) and the mint-path comment. The value lives in three more places, in a forced order:

  1. agenta_cloud hosting/docker-compose/litellm/config.yaml: the proxy's mint bounds (upperbound + default). Committed on feat/litellm-proxy (99f417a3c); must deploy FIRST, because a PostHog payload above the proxy's upperbound fails every mint with HTTP 400.
  2. The PostHog payload starter-credits-bridge-policy: raise key_tpm_limit after that deploy. Cloud reads only this.
  3. Existing minted keys keep 200k until a /key/update pass on the proxy admin route.

Tests

  • ee/tests/pytest/unit/test_starter_credits_bridge_seeding.py: 72 passed. The development-policy assertion follows the new value; the fixtures that feed arbitrary payloads keep their own numbers.

https://claude.ai/code/session_014s6jqKCsVKsNMmnrJVJkZt

Mirrors the proxy-side raise in agenta_cloud (upperbound + default mint
bounds): the 200k tokens-per-minute per-key cap fired on ordinary
large-context agent turns (12 refusals in 72h on EU cloud). Cloud reads
the PostHog payload, which is raised separately after the proxy deploy;
this keeps the no-PostHog development policy consistent.

Claude-Session: https://claude.ai/code/session_014s6jqKCsVKsNMmnrJVJkZt
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 29, 2026
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 29, 2026 8:52am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Increased the development fallback policy’s key throughput limit to 1,000,000 tokens per minute.
  • Documentation
    • Updated the documented proxy key-generation cap to reflect the new limit.
  • Tests
    • Updated coverage to verify the revised development policy limit.

Walkthrough

The development fallback policy raises key_tpm_limit from 200,000 to 1,000,000. The related unit test and _mint_key documentation now use the updated limit.

Changes

Development Policy Limit

Layer / File(s) Summary
Update development policy limit
api/ee/src/core/starter_credits_bridge/types.py, api/ee/tests/pytest/unit/test_starter_credits_bridge_seeding.py, api/ee/src/core/starter_credits_bridge/service.py
The fallback policy sets key_tpm_limit to 1,000,000. The unit test expects this value. The _mint_key comment documents the same cap.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: 🔵 Low · up to f895a

New starter-credit keys request a 1,000,000 TPM limit, but issuing them can fail with HTTP 400 if the proxy’s matching upper bound is not deployed first. The change is otherwise mergeable with explicit owner awareness of this deployment-order requirement.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the increase from 200,000 to 1,000,000 tokens per minute, the unchanged limits, deployment dependencies, and test results.
Title check ✅ Passed The title clearly and concisely describes the primary change: raising the free-credits per-key TPM cap to 1,000,000.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/starter-credits-tpm-cap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: a485f1ba-1db3-4bb4-abe9-74e38182c455

📥 Commits

Reviewing files that changed from the base of the PR and between e626c8e and f895ac6.

📒 Files selected for processing (3)
  • api/ee/src/core/starter_credits_bridge/service.py
  • api/ee/src/core/starter_credits_bridge/types.py
  • api/ee/tests/pytest/unit/test_starter_credits_bridge_seeding.py

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread api/ee/src/core/starter_credits_bridge/types.py
@mmabrouk
mmabrouk changed the base branch from release/v0.114.3 to main August 29, 2026 09:12

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mmabrouk mmabrouk added the lgtm This PR has been approved by a maintainer label Aug 31, 2026
@mmabrouk
mmabrouk changed the base branch from main to release/v0.114.4 August 31, 2026 16:03
@mmabrouk
mmabrouk merged commit 5a55e4c into release/v0.114.4 Aug 31, 2026
49 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant