xtekky/gpt4free · error · RateLimitError

No coins left. Log in with a different account or wait a…

Error message

No coins left. Log in with a different account or wait a while

What it means

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.

Solutions

  1. Wait for the quota window to reset before retrying
  2. Switch to a different logged-in Bing account (different cookies)
  3. Add rate-limit handling: catch RateLimitError and back off or fall back to another image provider

Example fix

# before
images = create_images(session, prompt, cookies)

# after
from g4f.errors import RateLimitError
try:
    images = create_images(session, prompt, cookies)
except RateLimitError:
    images = fallback_image_provider(prompt)  # or wait and retry
Defensive patterns

Strategy: retry

Try / catch

from g4f.errors import RateLimitError
try:
    images = create_images(session, prompt, cookies)
except RateLimitError:
    time.sleep(3600)
    images = create_images(session, prompt, cookies)  # or switch account/provider

Prevention

When it happens

Trigger: Creating images while the logged-in Bing account has exhausted its generative-image coins for the period.

Common situations: Bulk image generation loops draining the quota, shared/test account already depleted, daily quota not yet reset.

Related errors


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

Appendix: source

Thrown at g4f/Provider/needs_auth/bing/create_images.py:98

    Returns:
        List[str]: A list of URLs to the created images.

    Raises:
        RuntimeError: If image creation fails or times out.
    """
    if not has_requirements:
        raise MissingRequirementsError('Install "beautifulsoup4" package')
    url_encoded_prompt = quote(prompt)
    payload = f"q={url_encoded_prompt}&rt=4&FORM=GENCRE"
    url = f"{BING_URL}/images/create?q={url_encoded_prompt}&rt=4&FORM=GENCRE"
    async with session.post(
        url, allow_redirects=False, data=payload, timeout=timeout
    ) as response:
        response.raise_for_status()
        text = (await response.text()).lower()
        if "0 coins available" in text:
            raise RateLimitError(
                "No coins left. Log in with a different account or wait a while"
            )
        for error in ERRORS:
            if error in text:
                raise RuntimeError(f"Create images failed: {error}")
    if response.status != 302:
        url = f"{BING_URL}/images/create?q={url_encoded_prompt}&rt=3&FORM=GENCRE"
        async with session.post(
            url, allow_redirects=False, timeout=timeout
        ) as response:
            if response.status != 302:
                raise RuntimeError(f"Create images failed. Code: {response.status}")

    redirect_url = response.headers["Location"].replace("&nfy=1", "")
    redirect_url = f"{BING_URL}{redirect_url}"
    request_id = redirect_url.split("id=")[-1]
    async with session.get(redirect_url) as response:
        response.raise_for_status()

View on GitHub (pinned to 973504e177)