Skip to content

feat: prefer OpenAI accounts by remaining quota#2326

Open
MiaoZang wants to merge 1 commit into
Wei-Shaw:mainfrom
MiaoZang:upstream/openai-quota-scheduling
Open

feat: prefer OpenAI accounts by remaining quota#2326
MiaoZang wants to merge 1 commit into
Wei-Shaw:mainfrom
MiaoZang:upstream/openai-quota-scheduling

Conversation

@MiaoZang
Copy link
Copy Markdown

@MiaoZang MiaoZang commented May 9, 2026

Summary

  • add quota_remaining account selection mode for same-priority account selection
  • add optional quota balance snapshot caching for quota-based ranking
  • add OpenAI OAuth quota strategy helpers and reset-window-aware remaining quota calculation
  • add optional sticky session release when a same-priority OpenAI account has a much higher remaining quota
  • include small Windows compile fixes needed for local Go test runs on Windows

Tests

  • GOTMPDIR=T:\C++save\GPT\sub2api部署\tmp-go go test -tags unit ./internal/config ./internal/service -run 'TestLoad.*Scheduling|TestEffectiveRemainingQuota|TestGatewayService.*Quota|TestGatewayService_ShouldReleaseOpenAIStickySessionForQuotaGap|TestGatewayService_ShouldNotReleaseOpenAIStickySessionForQuotaGapAcrossPriority|TestOpenAIQuotaStrategySchedulable|TestParseGatewayRequest_MaxTokensBoundary' -count=1 -v
  • git diff --cached --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant