binary-husky/gpt_academic · error · Exception

Authentication failed

Error message

Authentication failed

What it means

Synchronous (requests-based) Bing/Copilot conversation creation failed: after trying the configured BING_PROXY_URL (default https://edgeservices.bing.com/edgesvc/turing/conversation/create) and the fallback proxy edge.churchless.tech, the HTTP status was still not 200, so edge_gpt_free raises Exception('Authentication failed'). The printed status code/body/url above the raise identify the actual response.

Source

Thrown at request_llms/edge_gpt_free.py:341

            headers=HEADERS_INIT_CONVER,
        )
        if cookies:
            for cookie in cookies:
                self.session.cookies.set(cookie["name"], cookie["value"])
        # Send GET request
        response = self.session.get(
            url=os.environ.get("BING_PROXY_URL")
            or "https://edgeservices.bing.com/edgesvc/turing/conversation/create",
        )
        if response.status_code != 200:
            response = self.session.get(
                "https://edge.churchless.tech/edgesvc/turing/conversation/create",
            )
        if response.status_code != 200:
            print(f"Status code: {response.status_code}")
            print(response.text)
            print(response.url)
            raise Exception("Authentication failed")
        try:
            self.struct = response.json()
        except (json.decoder.JSONDecodeError, NotAllowedToAccess) as exc:
            raise Exception(
                "Authentication failed. You have not been accepted into the beta.",
            ) from exc
        if self.struct["result"]["value"] == "UnauthorizedRequest":
            raise NotAllowedToAccess(self.struct["result"]["message"])

    @staticmethod
    async def create(
        proxy=None,
        cookies=None,
    ):
        self = _Conversation(async_mode=True)
        self.struct = {
            "conversationId": None,
            "clientId": None,

View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Check the printed status code and response body — 401/403 means cookies/beta, 429 means rate limit or IP block
  2. Provide fresh valid Bing cookies to the conversation client (the newbing bridge passes cookies; stale cookies are the #1 cause)
  3. If self-hosting BING_PROXY_URL, verify that proxy is alive and forwards cookies correctly; otherwise clear the env var to use the default + fallback
  4. Switch to a supported model/bridge (this free endpoint is inherently unreliable) or retry later when the fallback proxy recovers

Example fix

# before
os.environ.pop('BING_PROXY_URL', None)  # both bing + churchless return non-200

# after: supply valid cookies via the newbing bridge config
# config_private.py
NEWBING_COOKIES = '...fresh _U cookie from edge browser...'
Defensive patterns

Strategy: retry

Validate before calling

import requests
for url in (os.environ.get('BING_PROXY_URL') or 'https://edgeservices.bing.com/edgesvc/turing/conversation/create',
            'https://edge.churchless.tech/edgesvc/turing/conversation/create'):
    r = requests.get(url, timeout=10)
    print(url, r.status_code)  # both must be 200 for the free bridge to work

Try / catch

for attempt in range(2):
    try:
        convo = _Conversation(sync_mode=True, cookies=cookies)
        break
    except Exception as e:
        if 'Authentication failed' in str(e) and attempt == 0:
            cookies = refresh_bing_cookies()
            continue
        raise

Prevention

When it happens

Trigger: _Conversation.__init__ path in request_llms/edge_gpt_free.py:341: both conversation/create GETs return non-200. Typical when Bing rejects the client cookies (missing/invalid edge cookies), the beta is not enabled for the account, an IP is blocked (429/403), or the churchless fallback proxy is down.

Common situations: Using the free newbing/edge_gpt_free bridge without valid Bing cookies; region/IP blocked by edgeservices.bing.com; both endpoints rate-limited; BING_PROXY_URL pointing at a dead self-hosted proxy.

Understand the failure class

Related errors


AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14). Data as JSON: /api/errors/f5c983b87333487c. Report an issue: GitHub.