Skip to main content

bingart is an unofficial API wrapper for Bing Image Creator (based on DALL-E 3).

Project description

🎨 bingart

bingart is an unofficial 🤫 API wrapper for Bing Image Creator (based on DALL-E 3). It allows you to programmatically generate 🖼️ AI-powered images using Bing's image creation tool.

⚠️ Warning: The _U auth cookie should be changed every 2-4 weeks for working.

💡 Description

This module uses web scraping and engineering techniques to interface with Bing's internal image creation APIs. It is not an official API client.

🔑 Key Features

  • 🖼️ Generate images by providing a text prompt
  • 📸 Get image URLs up to 4 generated images
  • 🔐 Authentication via saved Bing cookies or auto-fetched from browsers
  • ⚠️ Custom exceptions for common issues

💻 Usage

Import and instantiate the BingArt class with a valid _U cookie value:

from bingart import BingArt

bing_art = BingArt(auth_cookie_U='...')

try:
    results = bing_art.generate_images('sunset')
    print(results)
finally:
    bing_art.close_session()

Sometimes an extra cookie called KievRPSSecAuth is required for it to work properly

bing_art = BingArt(auth_cookie_U='...', auth_cookie_KievRPSSecAuth='...')

Also, you can try the auto cookie search feature

bing_art = BingArt(auto=True)

Call generate_images() with your query text:

results = bing.generate_images("a cat painting in Picasso style")

The return value contains image URLs and original prompt:

{
  "images": [
    {"url": "https://..."}
  ],
  "prompt": "a cat painting in Picasso style"
}

🚨 Exceptions

  • AuthCookieError: Invalid authentication cookie
  • PromptRejectedError: Prompt rejected as unethical

🤝 Contributing

Pull requests welcome! Please open an issue to discuss major changes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bingart-1.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

bingart-1.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file bingart-1.1.1.tar.gz.

File metadata

  • Download URL: bingart-1.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for bingart-1.1.1.tar.gz
Algorithm Hash digest
SHA256 96d6c1a93cb47921b5a5296be56855f2cff6489a2e3a5d623380ff5ca48252af
MD5 056d8de27a452eb3ecbbbe88554826db
BLAKE2b-256 4d7db6370de2649841594d9c77ce540537dfb81435c1f30b9cdcc27b6b4d615a

See more details on using hashes here.

File details

Details for the file bingart-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: bingart-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for bingart-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 adc1005dca38c4c0e40835fd17ef028268eb5593ebbe31b90eaaa50d52639e0f
MD5 39988174896f64b7e3cc4fb876db8e39
BLAKE2b-256 11e612b1d911c1a317113afa701d5f69789dacd4d34d214dfd5cb1af1daf2628

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page