Significant-Gravitas/AutoGPT · error · HTTPException

Codex credentials must be created through ChatGPT sign-in

Error message

Codex credentials must be created through ChatGPT sign-in

What it means

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.

Source

Thrown at autogpt_platform/backend/backend/api/features/integrations/router.py:576

        access_token_expires_at=credential.access_token_expires_at,
    )


@router.post("/{provider}/credentials", status_code=201, summary="Create Credentials")
async def create_credentials(
    user_id: Annotated[str, Security(get_user_id)],
    provider: Annotated[
        ProviderName, Path(title="The provider to create credentials for")
    ],
    credentials: Credentials,
) -> CredentialsMetaResponse:
    if is_sdk_default(credentials.id):
        raise HTTPException(
            status_code=status.HTTP_403_FORBIDDEN,
            detail="Cannot create credentials with a reserved ID",
        )
    if provider == ProviderName.CODEX:
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail="Codex credentials must be created through ChatGPT sign-in",
        )
    if (
        isinstance(credentials, OAuth2Credentials)
        and credentials.refresh_strategy == "provider_runtime"
    ):
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail="Provider-runtime credentials cannot be created directly",
        )
    credentials.provider = provider
    try:
        await creds_manager.create(user_id, credentials)
    except Exception:
        logger.exception("Failed to store credentials")
        raise HTTPException(
            status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Use the Codex login flow instead: start ChatGPT sign-in and complete it via the codex login endpoints (_complete_codex_login / codex_login_coordinator)
  2. Filter 'codex' out of generic credential-creation UI or scripts
Defensive patterns

Strategy: validation

Validate before calling

if provider == 'codex':
    raise ValueError('codex credentials are created via ChatGPT sign-in, not POST /credentials')

Type guard

const isDirectCreateProvider = (p: string): boolean => p !== 'codex';

Prevention

When it happens

Trigger: POST /integrations/codex/credentials with any payload.

Common situations: 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.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/accc432ef462d867. Report an issue: GitHub.