Skip to content

fix(gateway): list every model a ChatGPT account can use; stop forwarding the ChatGPT app's identity - #217

Merged
fylorn merged 1 commit into
mainfrom
fix/chatgpt-honest-client
Sep 27, 2026
Merged

fylorn merged 1 commit into
mainfrom
fix/chatgpt-honest-client

Conversation

@fylorn

@fylorn fylorn commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Two problems with ChatGPT account upstreams

1. New models were missing from the model list

The Codex backend hides models whose minimal_client_version is above the client_version a client reports on GET /models. Measured on 2026-09-27 with a Free account:

client_version visible models
0.0.0, 0.154.9 gpt-5.6-terra, gpt-5.6-luna, gpt-5.5
0.158.0, 99999.0.0 the same plus gpt-6-luna (minimal_client_version 0.155.0)

ThinkWatch reported 0.0.0, so gpt-6-luna was not in the upstream's list and admission refused it with No upstream serves model gpt-6-luna (the ChatGPT app offers it from its bundled catalog). The account can use it: a plain Responses request for gpt-6-luna with ThinkWatch's own identity completed normally.

CLIENT_VERSION is now 99999.0.0: the list shows whatever the account can use, and the client decides what it can drive. It only filters the list; originator and User-Agent still say ThinkWatch. A 99999.0.0 listing returned nothing beyond what 0.158.0 returns, and the account's token was still valid three minutes after it.

2. The ChatGPT app's identity was forwarded

The Codex inside the ChatGPT desktop app, while signed in to ChatGPT, adds per request:

  • x-oai-attestation: an attestation generated by the app
  • x-codex-installation-id
  • x-codex-turn-metadata: JSON that embeds the installation ID

It also repeats x-codex-installation-id and x-codex-turn-metadata inside the body's client_metadata.

The gateway replaced originator, User-Agent and version but forwarded all of these, so the backend received the official app's attestation on a token that ThinkWatch had obtained. On 2026-09-27 the account's token was revoked within 20 seconds of the first request the app sent through the gateway. The request itself succeeded, and later tests with ThinkWatch's own identity did not revoke the new token.

  • The three headers join tw_config::chatgpt::IDENTITY_HEADERS: they are not forwarded to a ChatGPT account upstream, and an upstream's configured headers cannot contain them.
  • shape_passthrough removes the two client_metadata entries. Like the identity headers, they are not reported as dropped fields, so a Codex request is not shown as translated. session_id, x-codex-window-id and the rest of client_metadata are forwarded as before.

Tests

  • tw-gateway/tests/chatgpt.rs: a Codex request that carries the three headers and the two client_metadata entries reaches the backend without them, and with x-codex-window-id and client_metadata.session_id intact. The models request uses client_version=99999.0.0.
  • chatgpt.rs unit tests: keeps_client_header refuses the three headers; shape_passthrough removes only the identity entries and still reports only max_output_tokens as dropped.
  • credential.rs: the three headers are rejected in a ChatGPT account upstream's configured headers.

cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace pass locally. No control-protocol change (25), no request store schema change (21), no new message codes.

🤖 Generated with Claude Code

…ding the ChatGPT app's identity

The Codex backend hides models whose minimal_client_version is above the
client_version a client reports when it lists models. ThinkWatch reported
0.0.0, so gpt-6-luna (which needs 0.155.0) was missing from a ChatGPT account
upstream's list, and requests for it were refused with "No upstream serves
model ..." although the account can use it: a Free account generates with it
normally. Report 99999.0.0 instead, so the list shows whatever the account can
use and the client decides what it can drive. Who is asking is still stated by
ThinkWatch's own originator and User-Agent.

The Codex inside the ChatGPT desktop app, while signed in to ChatGPT, adds the
app's per-request attestation (x-oai-attestation), its installation ID
(x-codex-installation-id) and turn metadata that embeds the installation ID
(x-codex-turn-metadata), and repeats the last two in the body's
client_metadata. The gateway replaced originator, User-Agent and version but
forwarded these, so the backend saw the official app's attestation on a token
that ThinkWatch had obtained. The account's token was revoked within 20 seconds
of the first such request. The three headers join IDENTITY_HEADERS: they are
not forwarded to a ChatGPT account upstream and cannot be set in its configured
headers. The two client_metadata entries are removed from passthrough bodies,
and like the identity headers they are not reported as dropped fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit ac697e9 into main Sep 27, 2026
4 checks passed
@fylorn
fylorn deleted the fix/chatgpt-honest-client branch September 27, 2026 13:42
@fylorn fylorn mentioned this pull request Sep 27, 2026
fylorn added a commit that referenced this pull request Sep 27, 2026
Minor release for #217 and #218.

- Bump the workspace version to 0.53.0
- release-notes/0.53.0.md

Control-plane protocol 26 (was 25): ProviderView and ProviderInput carry
forward_client_identity. The request store schema is unchanged (21).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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