[Suggestion] Add ingress rate limiting and 403 circuit breaker for /v1/messages #651
DarKWinGTM
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Ingress
/v1/messagescurrently has no rate limiting or circuit breaker. Clients can send bursts directly to upstream; even when upstream returns 403 (e.g., CONSUMER_INVALID / SERVICE_DISABLED), requests continue rapidly, causing spam/flood and repeated error bursts.Current behavior
newProxyAwareHTTPClient.sdk/cliproxy/auth/manager.go) defaults to retry=3, max interval=30s, which is still quick under client floods.Expected behavior
/v1/messages.Evidence / logs (examples)
[2025-12-07 16:36:13] ... | 403 | ... | POST "/v1/messages?beta=true"body:"Permission denied on resource project calm-flow-0ffd9."metadata:consumer=projects/calm-flow-0ffd9,service=cloudaicompanion.googleapis.com[2025-12-07 16:36:14] ... | 403 | ... | POST "/v1/messages?beta=true"body:"Permission denied on resource project calm-flow-80b89."[2025-12-07 16:36:14] ... | 403 | ... | POST "/v1/messages?beta=true"body:"Gemini for Google Cloud API (Staging) has not been used in project firm-arcadia-b5j71 before or it is disabled..."metadata includesservice=staging-cloudaicompanion.sandbox.googleapis.com,activationUrl=.../overview?project=firm-arcadia-b5j71prime-turbine-hc2p6in the same second.Proposed changes
/v1/messages(including?beta=true).reason= CONSUMER_INVALID or SERVICE_DISABLED.Affected code (references)
Acceptance criteria
/v1/messageswith buckets per IP + per auth/key + per model.🤖 Analysis and report generated by Claude Code (gpt-5.1-codex-max-xhigh) via Deep Analysis Protocol.
Beta Was this translation helpful? Give feedback.
All reactions