odysseus-dev/odysseus · error · ValueError

ChatGPT Subscription connected, but no usable Codex models w

Error message

ChatGPT Subscription connected, but no usable Codex models were discovered for this account.

What it means

A server-side ValueError raised in _provision_endpoint after a successful token exchange when fetch_available_models(access_token) returns an empty list. The account authenticated fine, but the API exposed no Codex-capable models for it, so provisioning refuses to create a useless endpoint. Usually an account-entitlement problem rather than a code bug.

Source

Thrown at routes/chatgpt_subscription_routes.py:34

)
from src.auth_helpers import get_current_user
from src import chatgpt_subscription

logger = logging.getLogger(__name__)

_DEVICE_FLOW_STORE = PendingDeviceFlowStore()


def _provision_endpoint(tokens: Dict, owner: Optional[str]) -> Dict:
    access_token = tokens.get("access_token")
    refresh_token = tokens.get("refresh_token")
    if not access_token or not refresh_token:
        raise ValueError("ChatGPT token response was missing access_token or refresh_token")

    base = chatgpt_subscription.DEFAULT_CHATGPT_SUBSCRIPTION_BASE_URL
    models = chatgpt_subscription.fetch_available_models(access_token)
    if not models:
        raise ValueError("ChatGPT Subscription connected, but no usable Codex models were discovered for this account.")
    db = SessionLocal()
    try:
        auth = (
            db.query(ProviderAuthSession)
            .filter(
                ProviderAuthSession.provider == chatgpt_subscription.CHATGPT_SUBSCRIPTION_PROVIDER,
                ProviderAuthSession.owner == owner,
            )
            .first()
        )
        if auth is None:
            auth = ProviderAuthSession(
                id=str(uuid.uuid4())[:8],
                provider=chatgpt_subscription.CHATGPT_SUBSCRIPTION_PROVIDER,
                owner=owner,
                label="ChatGPT Subscription",
                base_url=base,
                auth_mode="chatgpt",

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Verify the signed-in ChatGPT account actually has an active subscription that includes Codex, then reconnect with that exact account.
  2. Sign out and redo the device flow, double-checking the user_code is entered under the intended account.
  3. Check chatgpt_subscription.fetch_available_models filtering logic against the current OpenAI models API response (model IDs may have changed).
  4. Confirm the subscription is active (not past-due/cancelled) in the ChatGPT billing settings.
Defensive patterns

Strategy: validation

Try / catch

try:
    _provision_endpoint(tokens, owner)
except ValueError as e:
    if 'no usable Codex models' in str(e):
        show_user('Connected account has no Codex access. Sign in with a subscribed ChatGPT account.')
    raise

Prevention

When it happens

Trigger: Signing in with a free/unpaid ChatGPT account that has no Codex access; a Plus/Team account in a region or workspace where Codex models are not enabled; the models list endpoint returning an empty or unrecognized payload after an upstream API change.

Common situations: User connects the wrong ChatGPT account (personal instead of the subscribed one); subscription lapsed or is billed through a region without Codex; OpenAI renames model IDs so the client-side filter matches nothing.

Related errors


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/9c3698e4f9b3b861. Report an issue: GitHub.