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
- 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
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
- Exclude codex from programmatic credential seeding
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
- Codex credentials must be created through ChatGPT sign-in
- codex_credential_not_found
- Picker tokens are only available for OAuth2 credentials
- Credential has no access token; reconnect the account
- Provider-runtime credentials cannot be created directly
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/accc432ef462d867.
Report an issue: GitHub.