You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(quota): decode GeminiApiErrorDetails quota reset time, RPM/daily metric, and verification status #364
AI Studio RPC error responses include type.googleapis.com/google.internal.alkali.applications.makersuite.v1.GeminiApiErrorDetails (_.Go in m_b.js), which decodeRPCErrorMetadata previously skipped (only parsing google.rpc.RetryInfo and google.rpc.ErrorInfo):
internal/aistudio/client.go:
Decode GeminiApiErrorDetails in decodeRPCErrorMetadata:
field 29 (index 28, QuotaFailureHyb): extract violations[0][3] -> Metadata["quota_metric"] and violations[0][4] -> Metadata["quota_limit"] (quotaId).
field 33 (index 32, google.protobuf.Timestamp[seconds, nanos]): decode exact QuotaResetAt (zCa in m_b.js).
field 41 (index 40): set AccountVerificationRequired = true so RPCError.accessDenial() unwraps to camoufoxnative.ErrAccountVerification structurally even if the error text changes.
internal/aistudio/quota.go:
Classify daily quota metrics (Iyb in m_b.js: generate_requests_per_model_per_user, generate_content_tokens_per_model_per_user, predict_requests_per_model_per_user, predict_long_running_generations_per_model_per_user_per_day, scaled_predict_long_running_generations_per_model_per_user_per_day) as DailyLimitKind when quota_limit does not contain PerMinute.
Use rpcError.QuotaResetAt directly as the cooldown Until timestamp when RetryDelay is absent (avoiding blind 1-minute escalation or Pacific-midnight guessing).
internal/aistudio/rpc_error_details_test.go: unit tests covering daily metric + exact reset timestamp, PerMinute override, and field 41ErrAccountVerification unwrapping.
验证 / Verification
go test -mod=readonly -trimpath -count=1 ./internal/aistudio/... ./internal/api/... (internal/aistudio0.048s, internal/api0.091s) — passed.
go vet -mod=readonly ./internal/aistudio/... ./internal/api/... ./internal/i18n/... — passed.
Each user can have at most 3 open issues at a time, so this one was closed automatically. Please wait until your existing issues are resolved, or add this to one of them.
Activity
github-actions commentedon Dec 3, 2026
每人最多同时打开 3 个 Issue,这个 Issue 已自动关闭。请等已有的 Issue 处理完再提,或把内容补充到已有的 Issue 里。
Each user can have at most 3 open issues at a time, so this one was closed automatically. Please wait until your existing issues are resolved, or add this to one of them.