xtekky/gpt4free · error · MissingAuthError

DeepSeekAuth: No authentication found.

Error message

DeepSeekAuth: No authentication found.

What it means

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.

Source

Thrown at g4f/Provider/needs_auth/DeepSeek.py:349

            except Exception as e:
                debug.error(
                    f"DeepSeekAuth: Failed to delete using {method_info['name']}: {e}"
                )
                # Continue to next method

        # All methods failed
        debug.error(
            f"DeepSeekAuth: All deletion methods failed for session {chat_session_id}"
        )
        # Don't raise - deletion is not critical

    @classmethod
    async def get_quota(cls, **kwargs):
        cookies = get_cookies(cls.cookie_domain, False)
        headers = get_headers(cls.cookie_domain)
        if cookies and headers.get("authorization"):
            return {"success": True}
        raise MissingAuthError("DeepSeekAuth: No authentication found.")

    @classmethod
    async def create_async_generator(
        cls,
        model: str,
        messages: Messages,
        cookies: Cookies = None,
        headers: dict = None,
        proxy: str = None,
        conversation: JsonConversation = None,
        web_search: bool = False,
        media: list = None,
        reasoning_effort: Optional[
            Literal["none", "low", "medium", "high", "x-high"]
        ] = None,
        delete_session: bool = False,
        **kwargs,
    ) -> AsyncResult:

View on GitHub (pinned to 973504e177)

Solutions

  1. Capture a HAR while logged in to chat.deepseek.com performing a chat request, and place it in har_and_cookies/.
  2. Confirm the HAR includes a request with the authorization header (not just cookies).
  3. Re-export if the token expired — DeepSeek bearer tokens in headers have limited lifetime.

Example fix

# before
quota = await DeepSeek.get_quota()
# MissingAuthError: DeepSeekAuth: No authentication found.

# after
# place a fresh deepseek HAR (with authorization header) in har_and_cookies/
quota = await DeepSeek.get_quota()  # -> {"success": True}
Defensive patterns

Strategy: validation

Validate before calling

from g4f.requests import get_cookies, get_headers
from g4f.Provider.needs_auth.DeepSeek import DeepSeek

def deepseek_auth_ready():
    cookies = get_cookies(DeepSeek.cookie_domain, False)
    headers = get_headers(DeepSeek.cookie_domain)
    return bool(cookies) and bool(headers.get("authorization"))

Try / catch

try:
    quota = await DeepSeek.get_quota()
except MissingAuthError:
    import_deepseek_har()  # prompt user / re-import, then retry

Prevention

When it happens

Trigger: 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.

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

Understand the failure class

Related errors


AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14). Data as JSON: /api/errors/3d09dbeeb30e7571. Report an issue: GitHub.