ac4af582301a4e8a29245dbba767eba31334ddf9
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b0174e7615 |
usage: a ChatGPT card says why its allowance can't be read, and a ChatGPT API account says where it shows
hmy on Discord: five ChatGPT accounts each said only "暂时无法获取额度"
(Allowance unavailable). danzi002 on Discord: accounts added through the
API never show usage, ones added as ChatGPT do.
What changed:
- Codex's usage read (codexWindows) now words its failure
(codex_usage_words.go): a Cloudflare challenge names the proxy/VPN
address as the usual cause; any other HTTP answer names its status and
what ChatGPT said; a network error says chatgpt.com couldn't be
reached; a reply magpie can't decode says so. The error still unwraps
to accountStatusError, so expiry and passing logic is unchanged.
- A ChatGPT API account (chatgpt-api) was read as a Codex account: a
saved one said "chatgpt-api accounts can't be used side by side", the
one in use read Codex's own sign-in ("Codex is signed out", or another
account's allowance under its name). OpenAI's API tells no plan usage,
so its row now says so, names chatgpt.com/settings/usage (SeeAt) and
says the same account added as ChatGPT shows it here.
- GUI quotaError translates each of these (en, zh, zh-TW, ja, de), and
"not read yet" (errNotAsked) gets its own words. The generic fallback
now reads "Allowance unavailable — hover for why"; the row's tooltip
has always been the raw error. Comments in app.js were shortened to
stay under TestCoreScriptBudget, which is not raised.
- docs/subsystems/providers-accounts.md describes the words.
Endpoint: the real wham/usage read of the owner's accounts in a sandbox
HOME copy (read-only, ~/.codex untouched) answered 200 and parsed, so
the endpoint itself is not broken; the "error decoding response body"
work is another session's and is not touched here.
Run (on mote; provider and gui again at the pushed head, rebased on
18c69aa46;
|
||
|
|
437bf023b8 |
codex, chatgpt-api: a conversation with tools reuses its cached prompt, its session sent in session-id/thread-id as Codex 0.162 sends it (#1473 inthink, #933 Scallions)
The ChatGPT backend looks up a conversation's prompt cache by the session headers, not by the body's prompt_cache_key. I probed a real Pro account (gpt-6.1-sol, 13 tools, about 7.6K-token prompt) directly: - key in body only, 6 requests: cached 0 every time - no key and no headers: 0 every time - session-id + thread-id: 0, then 7552 x5 - old session_id/conversation_id: 0, then 7552 - a bare request with no tools: 4096 every time. That is the instructions' shared cache, so #1473's "bare requests hit" pattern fits this. Codex CLI 0.162 (captured with codex exec against a fake server) now sends only session-id and thread-id. It no longer sends the underscored names, which a proxy may drop. Changes: - codexSign: sets session-id and thread-id from the prepared body's key (sessionHeaders). It drops the underscored names. A keyless body keeps the session the client named. - codexHeader: relays session-id/thread-id from Codex clients. - ChatGPT API (SIWC) provider: it sent only Authorization. Now it names the conversation (conversationKey for keyless clients) and sends the same session headers. Scallions' screenshots: chatgpt-api/ got 0% cache where codex/ got 10-99%. This was NOT tried against api.openai.com with a real ChatGPT API sign-in, since none is available here. Left for the reporter to confirm. Run: - Sandbox magpie on a real Codex account, client sending no key: old build cached 0/7296 erratically; new build 0, 0, then 7296 x4. - go test ./internal/provider ./internal/gateway: ok. - Break check: reverting codex_request.go and chatgpt_api.go turns TestCodexSignSessionHeaders, TestCodexSignAndBody and TestChatGPTAPISession red. - gofmt -l: clean. GOOS=linux and GOOS=windows go vet: clean. base_instructions and the identity line are unchanged. |
||
|
|
7a926dd3ce |
provider, gateway, gui: a ChatGPT plan can be signed in with OpenAI's Sign in with ChatGPT, as the ChatGPT API subscription, and asked on api.openai.com's Responses with the agent's own instructions (#933, knothhe)
OpenAI's Sign in with ChatGPT lets an open-source app on the user's machine use their ChatGPT plan through the public API: it registers itself on the way (client_id dynamic_agent_client, an ext_agent_host_id kept for this machine, agent_name_hint magpie), the callback brings the client id OpenAI issued, and the token (scope chatgpt.tokens.use.direct, resource https://api.openai.com/v1) is sent as a Bearer to api.openai.com/v1/responses. The new subscription, chatgpt-api ("ChatGPT API" in the add sheet, beside Codex's ChatGPT), signs in so in magpie (PKCE, a loopback callback on 1455 or any free port, the ID token's issuer, audience, nonce and expiry checked), keeps its accounts as the other in-magpie sign-ins do, refreshes under the issued client id (rotated refresh token, serialised; a refresh token OpenAI won't take again marks the account to sign in again), revokes it on sign-out, and lists the models /v1/models gives the token. Requests go with the agent's own instructions — no Codex prompt, no Codex headers; the Codex path is unchanged — stored nowhere and streamed, without the fields the API refuses for a ChatGPT token (max_output_tokens, temperature, prompt_cache_retention, …) and without hosted tools; a system message is a developer one. OpenAI's subscription_sharing_* refusals are said with what to do (the plan's usage at chatgpt.com/settings/usage, an ineligible account, a capability the token can't use). There is no usage meter: the token has no usage API. Tested against fake OpenAI auth and API servers (TestChatGPTAPISignIn, …Refused, …Refresh, …Body, …Explain; gateway TestChatGPTAPIRequests over chat completions, messages and responses) and the add sheet in Playwright on Chromium and WebKit (chatgpt-api-sub.test.cjs); the gateway and GUI tests fail without the change. Not yet signed in with a real ChatGPT account: the consent page needs the account's owner. go vet, go build (GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. |