feat: add OpenAI account request overrides and proxy-based admin/group controls#1462
Open
is7Qin wants to merge 17 commits intoWei-Shaw:mainfrom
Open
feat: add OpenAI account request overrides and proxy-based admin/group controls#1462is7Qin wants to merge 17 commits intoWei-Shaw:mainfrom
is7Qin wants to merge 17 commits intoWei-Shaw:mainfrom
Conversation
Add the group-level proxy_bucket_load_balance_enabled toggle and wire it through backend and frontend scheduling paths. This makes sticky routing keep priority, then narrows eligible accounts by the lower-load proxy bucket before reusing the existing account-level selector, while falling back cleanly when no proxy-backed candidates exist.
Support filtering admin accounts by proxy_id across the API and UI so large proxy pools can be searched precisely without stale cached list responses.
Keep proxy bucket scheduling visible across gateway modes while leaving OpenAI Messages dispatch settings scoped to OpenAI groups only.
Treat OpenAI account_deactivated responses as permanent account failures so OAuth accounts are marked error instead of only being cooled down temporarily.
Spread requests across equally healthy proxy buckets and prefer buckets with more available accounts so low-concurrency traffic no longer sticks to smaller proxy IDs.
Remove a no-op proxy bucket call in mixed scheduling and keep AI Studio endpoint bucket selection stable instead of random when no session hash is available.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds account-level OpenAI request override support, introduces optional proxy-bucket load balancing at the group level, and adds proxy-based filtering for the admin account list.
Changes:
- Add per-account OpenAI request override parsing/validation in frontend and apply sanitized overrides in gateway forwarding (excluding top-level
model). - Introduce group flag
proxy_bucket_load_balance_enabledand apply proxy-bucket narrowing in schedulers (OpenAI/Gateway/Gemini compat), plus wire it through admin group UI/API and persistence. - Add
proxy_idfiltering to admin accounts list across frontend/API/backend, including ETag variation.
Reviewed changes
Copilot reviewed 59 out of 59 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/views/admin/GroupsView.vue | Adds UI toggle to enable/disable proxy-bucket load balancing for groups. |
| frontend/src/views/admin/AccountsView.vue | Adds proxy_id to filter params and passes proxy list into filters component. |
| frontend/src/components/admin/account/AccountTableFilters.vue | Implements proxy dropdown filter UI and emits proxy_id updates. |
| frontend/src/utils/openaiRequestOverrides.ts | Adds JSON parse/stringify helpers with top-level model disallow. |
| frontend/src/utils/tests/openaiRequestOverrides.spec.ts | Adds unit tests for override parsing rules. |
| frontend/src/components/account/CreateAccountModal.vue | Adds OpenAI request override textarea and validation on submit. |
| frontend/src/components/account/EditAccountModal.vue | Adds OpenAI request override textarea and persistence via extra. |
| frontend/src/components/account/BulkEditAccountModal.vue | Adds bulk edit support for OpenAI request overrides and tests. |
| frontend/src/components/account/tests/BulkEditAccountModal.spec.ts | Verifies bulk update payload includes openai_request_overrides. |
| frontend/src/types/index.ts | Wires new fields into TS types for groups and requests. |
| frontend/src/i18n/locales/en.ts / zh.ts | Adds strings for proxy bucket toggle, proxy filter, and request overrides. |
| frontend/src/api/admin/accounts.ts | Adds proxy_id to list/listWithEtag query shape. |
| backend/migrations/081_add_group_proxy_bucket_load_balance.sql | Adds groups.proxy_bucket_load_balance_enabled column. |
| backend/internal/service/openai_request_overrides*.go | Implements override extraction/sanitization/merge and adds tests + forward tests. |
| backend/internal/service/openai_gateway_service.go | Applies overrides before extracting request metadata and clears parsed-body cache when modified. |
| backend/internal/service/openai_gateway_messages.go | Applies overrides for compat path and propagates derived metadata. |
| backend/internal/service/gateway_service.go | Adds proxy-bucket selection helpers and integrates them into scheduling paths. |
| backend/internal/service/openai_account_scheduler.go | Applies proxy-bucket narrowing in OpenAI load-balance scheduler. |
| backend/internal/service/gemini_messages_compat_service.go | Adds concurrency-aware proxy-bucket narrowing in Gemini compat scheduling and updates constructor wiring. |
| backend/internal/service/*_test.go | Updates repository interface signatures for new proxyID parameter and adds new scheduling tests. |
| backend/internal/service/admin_service.go + handler/admin/account_handler.go | Adds proxy_id filter support end-to-end and updates ETag inputs. |
| backend/internal/repository/account_repo.go | Implements proxy filter predicate in query. |
| backend/internal/repository/group_repo.go + ent/* | Persists and exposes new group flag through Ent schema/runtime/migrations. |
| backend/cmd/server/wire_gen.go | Wires ConcurrencyService into Gemini compat service constructor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR mainly introduces three feature areas:
feat: add OpenAI account request overridesfeat(group): add proxy-bucket load balancingfeat(admin): add proxy filter for account listChanges
OpenAI account request overrides
Group-level proxy-bucket load balancing
proxy_bucket_load_balance_enabledtoggleproxy_idbucketAdmin account list proxy filter
proxy_idVerification
go test ./... -run TestDoesNotExist -count=0pnpm typecheck