{"record":{"id":"accc432ef462d867","repo":"Significant-Gravitas/AutoGPT","slug":"codex-credentials-must-be-created-through-chatgpt-accc43","errorCode":null,"errorMessage":"Codex credentials must be created through ChatGPT sign-in","messagePattern":"Codex credentials must be created through ChatGPT sign-in","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/integrations/router.py","lineNumber":576,"sourceCode":"        access_token_expires_at=credential.access_token_expires_at,\n    )\n\n\n@router.post(\"/{provider}/credentials\", status_code=201, summary=\"Create Credentials\")\nasync def create_credentials(\n    user_id: Annotated[str, Security(get_user_id)],\n    provider: Annotated[\n        ProviderName, Path(title=\"The provider to create credentials for\")\n    ],\n    credentials: Credentials,\n) -> CredentialsMetaResponse:\n    if is_sdk_default(credentials.id):\n        raise HTTPException(\n            status_code=status.HTTP_403_FORBIDDEN,\n            detail=\"Cannot create credentials with a reserved ID\",\n        )\n    if provider == ProviderName.CODEX:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"Codex credentials must be created through ChatGPT sign-in\",\n        )\n    if (\n        isinstance(credentials, OAuth2Credentials)\n        and credentials.refresh_strategy == \"provider_runtime\"\n    ):\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"Provider-runtime credentials cannot be created directly\",\n        )\n    credentials.provider = provider\n    try:\n        await creds_manager.create(user_id, credentials)\n    except Exception:\n        logger.exception(\"Failed to store credentials\")\n        raise HTTPException(\n            status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/integrations/router.py#L558-L594","documentation":"POST /integrations/{provider}/credentials returns 400 'Codex credentials must be created through ChatGPT sign-in' when provider == 'codex'. Codex (ChatGPT-backed) credentials follow a dedicated interactive login coordinator flow; creating them by posting raw credential payloads would bypass that flow and is rejected.","triggerScenarios":"POST /integrations/codex/credentials with any payload.","commonSituations":"Client tries to seed a Codex credential for testing or automation instead of driving the ChatGPT sign-in flow; generic 'add credential for provider X' UI iterates over all providers including codex.","solutions":["Use the Codex login flow instead: start ChatGPT sign-in and complete it via the codex login endpoints (_complete_codex_login / codex_login_coordinator)","Filter 'codex' out of generic credential-creation UI or scripts"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if provider == 'codex':\n    raise ValueError('codex credentials are created via ChatGPT sign-in, not POST /credentials')","typeGuard":"const isDirectCreateProvider = (p: string): boolean => p !== 'codex';","tryCatchPattern":null,"preventionTips":["Exclude codex from programmatic credential seeding"],"tags":["credentials","codex","chatgpt","http-400"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}