From cfa8ea60a07eb70112f736075df49353275b79f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 9 May 2026 15:10:54 +0200 Subject: [PATCH] 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) --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- src/lib/ai/codex-client.ts | 18 ++++++++++++------ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2aee37f5..465ea30c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/package.json b/package.json index 386d64df7..8bb1dd51a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "healthlog", - "version": "1.4.12", + "version": "1.4.13", "private": true, "packageManager": "pnpm@10.31.0", "scripts": { diff --git a/src/lib/ai/codex-client.ts b/src/lib/ai/codex-client.ts index 155dbf753..c1c17aa3d 100644 --- a/src/lib/ai/codex-client.ts +++ b/src/lib/ai/codex-client.ts @@ -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)";