Skip to content

support ChatGPT subscription routing through the gateway - #184

Open
peterj wants to merge 3 commits into
mainfrom
peterj/codexsubscription
Open

peterj wants to merge 3 commits into
mainfrom
peterj/codexsubscription

Conversation

@peterj

@peterj peterj commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Adds programs.codex.auth: subscription so Codex can retain its ChatGPT
login while authenticating separately to the organization’s gateway.

Agentdesktop generates the Codex provider and pairing header automatically.
The local proxy forwards the ChatGPT token separately from gateway identity; the gateway validates identity before restoring the provider credential.

  • Requires a user-mode daemon and llmGateway.proxyUrl.
  • Adds controller subscription-billing classification.
  • Shares subscription-auth classification without changing Claude’s direct-helper flow.
  • Splits proxy caching, routing, and tests into separate modules.
  • Updates schemas, configuration-builder handling, documentation, and examples.

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
valid_until_unix: u64,
/// The credential's own expiry (the controller JWT `exp`), on both clocks:
/// a tunnel opened with the credential runs until then, not until the
/// cache stops reusing it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing we removed here, but moved into separate files under "llm_proxy" folder

Comment thread examples/codex-subscription/README.md Outdated
Comment on lines +20 to +23
Complete organization sign-in in the browser. The local Dex account is
`admin@example.com` with password `password`. Codex must also be signed in to
ChatGPT using its normal `codex login` flow. Run Codex in another terminal after
the daemon applies the configuration.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we do it this way rather than the way claude works? where the user logs into claude/codex via the agentdesktop oauth flow

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I can do it that way; this was simpler

transformations:
request:
set:
authorization: '"Bearer " + request.headers["x-llm-token"]'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use policies.backendAuth.key.expression request.headers["x-llm-token"].

Using generic transformation is not ideal since it runs too early + doesn't do proper redaction

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm although then it may not remove x-llm-token 🤔

gateway:
port: 4002

routes:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really a great example since everyone running an agw for LLM is going to be using the llm config not routes. This won't give any LLM features at all actually

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

This branch has not been deployed

No deployments
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.

2 participants