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.0.3.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: bingart-1.0.3.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for bingart-1.0.3.tar.gz
Algorithm Hash digest
SHA256 e4b2a9027496431fd01ab0a14ad3d1b1342beea837b513be9153c918984d698b
MD5 7dfe9af7d8652c01de355f775dfe86fd
BLAKE2b-256 c42507fe1d428aba05ee5b899eca835d37276c152f8112b6ac7a0dd43700a647

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bingart-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 504a015f56c92105f382620989d922cbc2449a26cbf1a037cc712cde4067a555
MD5 30d475033f67e88dfe8f65d470cbf958
BLAKE2b-256 71cb39c55d4fb526ed28122f4fd01940c9ef47f05e9152ba7f1a82ee9851de41

See more details on using hashes here.

Supported by

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