fix(ai): use plain gpt-5 model slug for ChatGPT-account auth

The Codex backend rejects `gpt-5-codex` when authenticated via the
ChatGPT-account OAuth flow with:

  "The 'gpt-5-codex' model is not supported when using Codex with a
   ChatGPT account."

The `-codex` suffix is API-key-auth-only. ChatGPT subscriptions route
through the plain `gpt-5` slug instead. Switch the client default and
expose a `CODEX_MODEL` env override for operators on plan tiers that
prefer a different slug (e.g. `gpt-5-codex-mini` or a future
preview model).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.7 committed 2026-05-09 15:10:54 +02:00
1 parent e4a07bc2e4
commit d7d60a42d7
3 files changed
+25 -7

No files matched your search

+12
View File
@@ -1,5 +1,17 @@
# Changelog
## [1.4.13] — 2026-05-09
### Fixed — KI Insights via ChatGPT
- **Modell-Slug für ChatGPT-Auth korrigiert.** Der Codex-Backend
lehnt `gpt-5-codex` mit ChatGPT-Subscription ab
(`The 'gpt-5-codex' model is not supported when using Codex with a
ChatGPT account.`) — dieses Slug ist nur für API-Key-Auth gültig.
Wechsel auf `gpt-5`, das Standard-Modell der ChatGPT-Plus/Pro-Tarife.
Operator-Override via `CODEX_MODEL`-Env-Var möglich falls dein
Plan einen anderen Default kennt.
## [1.4.12] — 2026-05-09
### Fixed — KI Insights via ChatGPT (komplette Codex-Integration)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "healthlog",
"version": "1.4.12",
"version": "1.4.13",
"private": true,
"packageManager": "pnpm@10.31.0",
"scripts": {
+12 -6
View File
@@ -21,13 +21,19 @@ import type { AIProvider, CompletionParams, CompletionResult } from "./types";
const CODEX_ENDPOINT = "https://chatgpt.com/backend-api/codex/responses";
/**
* `gpt-5.3-codex` is a *test placeholder* in the upstream codebase
* (`codex-rs/codex-api/src/sse/responses.rs:1374`), not a real model
* slug. The real CLI default is `gpt-5-codex`. The server safety-routes
* if needed and reports the actual model in the `OpenAI-Model`
* response header.
* Model slug for the ChatGPT-account auth path.
*
* Caveat: `gpt-5-codex` is the API-key-auth Codex slug but is rejected
* by the chatgpt.com backend with "model is not supported when using
* Codex with a ChatGPT account". For ChatGPT-OAuth we send the plain
* `gpt-5` slug — that's the Pro/Plus subscription model the backend
* routes by default. The server may safety-route to a different slug
* and reports the actual model in the `OpenAI-Model` response header.
*
* Operators can override via `CODEX_MODEL` env var on apps01 if a
* different slug works better for their ChatGPT plan tier.
*/
const CODEX_MODEL = "gpt-5-codex";
const CODEX_MODEL = process.env.CODEX_MODEL?.trim() || "gpt-5";
const ORIGINATOR = "healthlog";
const USER_AGENT = "HealthLog/1.0 (+https://healthlog.bombeck.io)";