{"record":{"id":"9cf7089970475fbb","repo":"BerriAI/litellm","slug":"str-e-9cf708","errorCode":null,"errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"exception","errorClass":"AuthenticationError","httpStatus":null,"severity":"error","filePath":"litellm/llms/chatgpt/responses/transformation.py","lineNumber":50,"sourceCode":"class ChatGPTResponsesAPIConfig(OpenAIResponsesAPIConfig):\n    def __init__(self) -> None:\n        super().__init__()\n        self.authenticator = Authenticator()\n\n    @property\n    def custom_llm_provider(self) -> LlmProviders:\n        return LlmProviders.CHATGPT\n\n    def validate_environment(\n        self,\n        headers: dict,\n        model: str,\n        litellm_params: GenericLiteLLMParams | None,\n    ) -> dict:\n        try:\n            access_token: Final = self.authenticator.get_access_token()\n        except GetAccessTokenError as e:\n            raise AuthenticationError(\n                model=model,\n                llm_provider=\"chatgpt\",\n                message=str(e),\n            )\n\n        account_id: Final = self.authenticator.get_account_id()\n        session_id: Final = ensure_chatgpt_session_id(litellm_params)\n        default_headers: Final = get_chatgpt_default_headers(access_token, account_id, session_id)\n        return {**default_headers, **headers}\n\n    def transform_responses_api_request(\n        self,\n        model: str,\n        input: Any,\n        response_api_optional_request_params: dict,\n        litellm_params: GenericLiteLLMParams,\n        headers: dict,\n    ) -> dict:","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/chatgpt/responses/transformation.py#L32-L68","documentation":"Same pattern as 1416 but on the Responses API path: `GetAccessTokenError` from `get_access_token()` is re-wrapped as `AuthenticationError` (provider `chatgpt`) with the original message. It fires in `validate_environment` when building request headers, before any model call is sent.","triggerScenarios":"Calling `litellm.responses(..., model=\"chatgpt/...\")` (or the responses endpoint) with missing, expired, or unrefreshable OAuth tokens. The underlying cause is any of the device-flow/refresh errors (1404–1415).","commonSituations":"Using ChatGPT Plus/Teams OAuth via the Responses API in environments without completed login; auth file deleted or corrupted; refresh token revoked after password change or logout.","solutions":["Run the ChatGPT device login to create/refresh the stored credentials, then retry the responses call.","Verify the auth file exists and is readable by the process (permissions, correct HOME dir in containers).","Re-login if the message indicates refresh failure or invalid grant.","Fall back to `openai/...` with an API key if OAuth is impractical in your deployment."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.responses(model=\"chatgpt/...\", input=\"hi\")\nexcept litellm.AuthenticationError as e:\n    logger.error(\"chatgpt responses auth failure: %s\", str(e))\n    raise","preventionTips":["Pre-authenticate via device login before deploying responses-API workloads.","Check auth file presence and permissions in container images (HOME, read access).","Re-login on refresh failures rather than retrying the call."],"tags":["chatgpt","auth","oauth","responses-api"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}