{"record":{"id":"3d09dbeeb30e7571","repo":"xtekky/gpt4free","slug":"deepseekauth-no-authentication-found","errorCode":null,"errorMessage":"DeepSeekAuth: No authentication found.","messagePattern":"DeepSeekAuth: No authentication found\\.","errorType":"exception","errorClass":"MissingAuthError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/DeepSeek.py","lineNumber":349,"sourceCode":"            except Exception as e:\n                debug.error(\n                    f\"DeepSeekAuth: Failed to delete using {method_info['name']}: {e}\"\n                )\n                # Continue to next method\n\n        # All methods failed\n        debug.error(\n            f\"DeepSeekAuth: All deletion methods failed for session {chat_session_id}\"\n        )\n        # Don't raise - deletion is not critical\n\n    @classmethod\n    async def get_quota(cls, **kwargs):\n        cookies = get_cookies(cls.cookie_domain, False)\n        headers = get_headers(cls.cookie_domain)\n        if cookies and headers.get(\"authorization\"):\n            return {\"success\": True}\n        raise MissingAuthError(\"DeepSeekAuth: No authentication found.\")\n\n    @classmethod\n    async def create_async_generator(\n        cls,\n        model: str,\n        messages: Messages,\n        cookies: Cookies = None,\n        headers: dict = None,\n        proxy: str = None,\n        conversation: JsonConversation = None,\n        web_search: bool = False,\n        media: list = None,\n        reasoning_effort: Optional[\n            Literal[\"none\", \"low\", \"medium\", \"high\", \"x-high\"]\n        ] = None,\n        delete_session: bool = False,\n        **kwargs,\n    ) -> AsyncResult:","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/DeepSeek.py#L331-L367","documentation":"MissingAuthError raised by DeepSeekAuth.get_quota: the quick auth probe loads .deepseek.com cookies and headers from g4f's storage and requires headers to contain an \"authorization\" entry. If either the cookies or the authorization header is missing, the provider has no way to query account quota, so it raises instead of returning a bogus answer.","triggerScenarios":"Calling DeepSeek.get_quota() with no DeepSeek HAR file / cookies imported, or an export that captured cookies but not the authorization request header. The check is cookies AND headers.get(\"authorization\") — both must be present.","commonSituations":"Using get_quota to check account status before any HAR was added; HAR exported from a logged-out capture; tooling that saved only Set-Cookie data and dropped request headers.","solutions":["Capture a HAR while logged in to chat.deepseek.com performing a chat request, and place it in har_and_cookies/.","Confirm the HAR includes a request with the authorization header (not just cookies).","Re-export if the token expired — DeepSeek bearer tokens in headers have limited lifetime."],"exampleFix":"# before\nquota = await DeepSeek.get_quota()\n# MissingAuthError: DeepSeekAuth: No authentication found.\n\n# after\n# place a fresh deepseek HAR (with authorization header) in har_and_cookies/\nquota = await DeepSeek.get_quota()  # -> {\"success\": True}","handlingStrategy":"validation","validationCode":"from g4f.requests import get_cookies, get_headers\nfrom g4f.Provider.needs_auth.DeepSeek import DeepSeek\n\ndef deepseek_auth_ready():\n    cookies = get_cookies(DeepSeek.cookie_domain, False)\n    headers = get_headers(DeepSeek.cookie_domain)\n    return bool(cookies) and bool(headers.get(\"authorization\"))","typeGuard":null,"tryCatchPattern":"try:\n    quota = await DeepSeek.get_quota()\nexcept MissingAuthError:\n    import_deepseek_har()  # prompt user / re-import, then retry","preventionTips":["Probe get_quota at startup to verify auth before real traffic.","Ensure the HAR capture includes the authorization request header.","Refresh the HAR when probes start failing."],"tags":["authentication","har-file","deepseek","quota"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}