[Feature]: opt-in hosted-gateway account controls (served-account header, trusted pin, cross-process seat)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 22/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- api, authentication
Research direction
Read the account-pool selection path first: accountLogLabel in the request log, the active-account/affinity/strategy logic, and the per-process session-affinity snapshot added in #7828. Part 1 (a config-gated x-ocx-served-account response header) is the smallest slice and the only one worth starting from, once a maintainer agrees it fits dev; parts 2 and 3 change the auth surface and the round-robin seating rule and need design sign-off. Done means the flag is off by default and tests cover the header being absent when no pooled account was admitted. Note the thread is one day old with no maintainer reply yet.
Written by the indexing model from the issue text.
Description
Area
Authentication and account pool
What are you trying to accomplish?
I run OpenCodex as a hosted gateway that sits behind a multi-tenant app. The app needs three things the local single-user proxy does not:
- Attribution. After a turn, the app needs to know which pooled account served it so it can charge the right tenant. That means an opaque account label, never an email or a token.
- Pinning. The app needs to send a request on one specific stored account, for example the tenant's own Claude subscription, and have it refused rather than failed over when that account is spent.
- Stable placement across processes. Many gateway processes share no state (serverless environments). Each one must put the same session on the same pooled account, or the prompt cache is rebuilt whenever a turn lands on a different process.
What prevents this today?
- There is no response header naming the served account.
accountLogLabelalready exists for the request log, but it is not exposed to the caller. - There is no per-request account selector. Selection is process-wide: the active account, affinity, or the strategy.
- Session affinity is per process, plus the private snapshot added in #7828. That snapshot covers a restart on one machine, but not N processes without a shared home. Under
round-robin, an unbound keyed session gets a process-dependent pick.
What should OpenCodex do?
I propose three opt-in pieces. Each would be its own small PR, and each is off by default:
- Served-account header. Behind an explicit config flag, responses carry
x-ocx-served-account: <accountLogLabel>. That is the same non-PII label the request log already stores, and the header is absent when no pooled account was admitted. - Trusted-caller account pin. Behind a config flag, and only for callers authenticated with the admin or a dedicated token,
x-ocx-account-providerandx-ocx-account-idselect one stored account. A pinned request still records the refusal or cooldown, but it never fails over to another account. A malformed pin, or a pin from an untrusted caller, is refused with 400. It is never silently ignored. - Cross-process seat (round-robin only). An unbound keyed session takes the rendezvous-hash winner of
sha256(key \0 accountId)over the eligible accounts, so every process agrees without shared state. On a 429, the session that hit it moves to its hash runner-up. The process's startup selection does not seat a keyed round-robin session.
Example usage or interface
POST /v1/chat/completions
Authorization: Bearer <trusted gateway token>
x-ocx-account-provider: claude
x-ocx-account-id: <stored account id>
→ 200, x-ocx-served-account: anthropic (ab12cd3)
Alternatives or workarounds
The vadymhimself fork has shipped all three on a hosted gateway since 2026-10. There they are gated by an environment flag and use x-agentradar-* header names:
- the per-request pin and served-account header;
- the hash seat (0428964be2, b60e434917, 0c4ffad3e3).
Keeping them fork-only works, but every rebase costs a port.
Additional context
I'm asking whether any of the three fits dev before I write code. Part 1 is the smallest and safest, so if you're open to it, I'd start there. Part 2 changes the auth surface, so I'd expect it to need maintainer-sponsored. Header names and gating are open for discussion.
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 1.3k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 814
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lidge-jun/opencodex
-
bug gui platform
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
lidge-jun/opencodex#9172 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
[Feature]: Include provider, model and account label in the `upstream failure` service.log linePossibly taken @EnesKartal claimed this 4 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lidge-jun/opencodex#9057 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
[Provider] antigravity-acp catalog omits gemini-4-hydrogen and gemini-4-neon that agy acp offersPossibly taken @sedoll claimed this 6 days ago. Opencatalog provider provider-compatibility
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
lidge-jun/opencodex#9037 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
bug cli
Difficulty 4/5 3-5 days Newbie friendliness 52/100
lidge-jun/opencodex#9171 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
account-pool enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
All issues in lidge-jun/opencodex
Similar issues
-
manually bump balena-preload to ^19.0.6Possibly taken @shaunmulligan claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 66/100
balena-io/balena-cli#3200 ·
Maintainers usually reply within 1 day
-
`MaterializedChatMessage._text` is quadratic in the number of text chunks (`+=` followed by `endsWith`), driving the extension host to heap OOMPossibly taken @olegius88 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
microsoft/vscode-prompt-tsx#205 ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
melgarafael/DeskcommCRM#5340 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
ehmpathy/rhachet-roles-ehmpathy#1529 ·
Maintainers usually reply within 1 day