{"record":{"id":"c0e10708baa5a77a","repo":"unslothai/unsloth","slug":"chatgpt-subscription-routing-is-fixed","errorCode":null,"errorMessage":"ChatGPT subscription routing is fixed.","messagePattern":"ChatGPT subscription routing is fixed\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"studio/backend/routes/providers.py","lineNumber":110,"sourceCode":"        updated_at = row[\"updated_at\"],\n    )\n\n\ndef _validate_provider_auth_contract(\n    info: dict,\n    *,\n    encrypted_api_key: str | None,\n    base_url: str | None,\n    models: list[str] | None,\n    updating: bool,\n    clear_api_key: bool = False,\n) -> None:\n    if info.get(\"auth_kind\") != \"chatgpt_oauth\":\n        return\n    if encrypted_api_key or clear_api_key:\n        raise HTTPException(status_code = 400, detail = \"ChatGPT subscriptions do not use API keys.\")\n    if base_url is not None and (not updating or base_url != info[\"base_url\"]):\n        raise HTTPException(status_code = 400, detail = \"ChatGPT subscription routing is fixed.\")\n    if models is not None and (not models or not set(models).issubset(set(info[\"default_models\"]))):\n        raise HTTPException(status_code = 400, detail = \"Choose only curated Codex models.\")\n\n\ndef _validate_max_output_tokens_contract(\n    provider_type: str,\n    field_was_set: bool,\n    value: Optional[int] = None,\n) -> None:\n    \"\"\"Reject a non-null override on a provider type with its own documented caps.\n\n    An explicit null is allowed through everywhere: the dialog shows the field for rows\n    it displays as Custom but the backend stores as `openai`, and a blank field\n    serialises as null, so rejecting it failed every unrelated edit of those rows.\n    Clearing an override that cannot exist is a no-op.\n    \"\"\"\n    if field_was_set and value is not None and provider_type != \"custom\":\n        raise HTTPException(","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/routes/providers.py#L92-L128","documentation":"A 400 from _validate_provider_auth_contract: for a chatgpt_oauth provider, a base_url was supplied that is either non-null on create, or different from the stored one on update. ChatGPT subscription traffic is routed through fixed OpenAI endpoints, so the base URL is not user-configurable.","triggerScenarios":"POST creating a ChatGPT subscription provider with a base_url in the body; PUT sending a base_url that differs from info['base_url']; an edit dialog that round-trips a modified base URL for all provider rows.","commonSituations":"Generic provider dialog used for every row; users attempting to proxy ChatGPT through a gateway; sync tooling that copies base_url between provider configs.","solutions":["Omit base_url when creating or updating ChatGPT subscription providers.","On update, echo the stored base_url unchanged (the update path explicitly allows re-sending the same value).","To route via a custom gateway, use a custom/API-key provider type instead."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (info.auth_kind === \"chatgpt_oauth\") {\n  if (creating && body.base_url != null) delete body.base_url;\n  if (updating && body.base_url !== info.base_url) body.base_url = info.base_url; // echo stored value\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["For subscription providers, never render or submit a base-url field.","On update, echo the stored base_url exactly rather than a user-edited one."],"tags":["chatgpt","oauth","base-url","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}