{"record":{"id":"d51256f3042f6e5a","repo":"xtekky/gpt4free","slug":"no-coins-left-log-in-with-a-different-account-or","errorCode":null,"errorMessage":"No coins left. Log in with a different account or wait a while","messagePattern":"No coins left\\. Log in with a different account or wait a while","errorType":"exception","errorClass":"RateLimitError","httpStatus":429,"severity":"error","filePath":"g4f/Provider/needs_auth/bing/create_images.py","lineNumber":98,"sourceCode":"\n    Returns:\n        List[str]: A list of URLs to the created images.\n\n    Raises:\n        RuntimeError: If image creation fails or times out.\n    \"\"\"\n    if not has_requirements:\n        raise MissingRequirementsError('Install \"beautifulsoup4\" package')\n    url_encoded_prompt = quote(prompt)\n    payload = f\"q={url_encoded_prompt}&rt=4&FORM=GENCRE\"\n    url = f\"{BING_URL}/images/create?q={url_encoded_prompt}&rt=4&FORM=GENCRE\"\n    async with session.post(\n        url, allow_redirects=False, data=payload, timeout=timeout\n    ) as response:\n        response.raise_for_status()\n        text = (await response.text()).lower()\n        if \"0 coins available\" in text:\n            raise RateLimitError(\n                \"No coins left. Log in with a different account or wait a while\"\n            )\n        for error in ERRORS:\n            if error in text:\n                raise RuntimeError(f\"Create images failed: {error}\")\n    if response.status != 302:\n        url = f\"{BING_URL}/images/create?q={url_encoded_prompt}&rt=3&FORM=GENCRE\"\n        async with session.post(\n            url, allow_redirects=False, timeout=timeout\n        ) as response:\n            if response.status != 302:\n                raise RuntimeError(f\"Create images failed. Code: {response.status}\")\n\n    redirect_url = response.headers[\"Location\"].replace(\"&nfy=1\", \"\")\n    redirect_url = f\"{BING_URL}{redirect_url}\"\n    request_id = redirect_url.split(\"id=\")[-1]\n    async with session.get(redirect_url) as response:\n        response.raise_for_status()","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/bing/create_images.py#L80-L116","documentation":"Raised as RateLimitError by Bing image creation when the first response body contains '0 coins left' text. Bing's image generator uses a 'coins' quota per account; zero remaining means the account cannot create images until the quota resets or another account is used.","triggerScenarios":"Creating images while the logged-in Bing account has exhausted its generative-image coins for the period.","commonSituations":"Bulk image generation loops draining the quota, shared/test account already depleted, daily quota not yet reset.","solutions":["Wait for the quota window to reset before retrying","Switch to a different logged-in Bing account (different cookies)","Add rate-limit handling: catch RateLimitError and back off or fall back to another image provider"],"exampleFix":"# before\nimages = create_images(session, prompt, cookies)\n\n# after\nfrom g4f.errors import RateLimitError\ntry:\n    images = create_images(session, prompt, cookies)\nexcept RateLimitError:\n    images = fallback_image_provider(prompt)  # or wait and retry","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from g4f.errors import RateLimitError\ntry:\n    images = create_images(session, prompt, cookies)\nexcept RateLimitError:\n    time.sleep(3600)\n    images = create_images(session, prompt, cookies)  # or switch account/provider","preventionTips":["Budget Bing coin usage; track how many generations per window you consume","Cache generated images by prompt hash to avoid redundant spends","Have a second image provider configured as fallback"],"tags":["rate-limit","quota","bing","image-generation","g4f"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}