Skip to main content

🌸 Beautiful and simple AI generation library for images, text, and audio

Project description

🌸 Blossom AI

A beautiful Python SDK for Pollinations.AI - Generate images, text, and audio with AI.


Warning!!

image generation and text generation are working properly in the current version of the library. Unfortunately, audio generation is temporarily unavailable. I'm already working on it.


✨ Features

  • 🖼️ Image Generation - Create stunning images from text descriptions
  • 📝 Text Generation - Generate text with various models
  • 🎙️ Audio Generation - Text-to-speech with multiple voices
  • 🚀 Simple API - Easy to use, beautifully designed
  • 🎨 Beautiful Errors - Helpful error messages with suggestions
  • 🔄 Reproducible - Use seeds for consistent results

📦 Installation

pip install blossom-ai

🚀 Quick Start

from blossom_ai import Blossom

# Initialize
ai = Blossom()

# Generate an image
ai.image.save("a beautiful sunset over mountains", "sunset.jpg")

# Generate text
response = ai.text.generate("Explain quantum computing in simple terms")
print(response)

# Generate audio
ai.audio.save("Hello, welcome to Blossom AI!", "welcome.mp3")

📖 Examples

Image Generation

from blossom_ai import Blossom

ai = Blossom()

# Generate and save an image
ai.image.save(
    prompt="a majestic dragon in a mystical forest",
    filename="dragon.jpg",
    width=1024,
    height=1024,
    model="flux"
)

# Get image data as bytes
image_data = ai.image.generate("a cute robot")

Text Generation

from blossom_ai import Blossom

ai = Blossom()

# Simple text generation
response = ai.text.generate("What is Python?")

# With system message
response = ai.text.generate(
    prompt="Write a haiku about coding",
    system="You are a creative poet"
)

# Reproducible results with seed
response = ai.text.generate(
    prompt="Generate a random idea",
    seed=42  # Same seed = same result
)

# Chat with message history
response = ai.text.chat([
    {"role": "system", "content": "You are a helpful assistant"},
    {"role": "user", "content": "What's the weather like?"}
])

Audio Generation

from blossom_ai import Blossom

ai = Blossom()

# Generate and save audio
ai.audio.save(
    text="Welcome to the future of AI",
    filename="welcome.mp3",
    voice="nova"
)

# Available voices
voices = ai.audio.voices()
print(voices)  # ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']

🎯 Supported Parameters

Text Generation

Parameter Type Description Supported
prompt str Your text prompt
model str Model to use (default: "openai")
system str System message to guide behavior
seed int For reproducible results
json_mode bool Return JSON response
private bool Keep response private
temperature float Randomness control ❌ Not supported in GET API

Note: The current Pollinations.AI GET endpoint doesn't support the temperature parameter. For temperature control, you would need to use their POST endpoint, which is currently experiencing issues.

Image Generation

Parameter Type Description
prompt str Image description
model str Model (default: "flux")
width int Width in pixels
height int Height in pixels
seed int Reproducibility
nologo bool Remove watermark (requires auth)
enhance bool Enhance prompt with AI
safe bool NSFW filtering

🛠️ API Methods

Blossom Class

ai = Blossom(timeout=30)  # Main client

ai.image  # ImageGenerator instance
ai.text   # TextGenerator instance  
ai.audio  # AudioGenerator instance

ImageGenerator

# Generate image (returns bytes)
image_data = ai.image.generate(prompt, **options)

# Save image to file
filepath = ai.image.save(prompt, filename, **options)

# List available models
models = ai.image.models()

TextGenerator

# Generate text (simple)
text = ai.text.generate(prompt, **options)

# Chat with message history
text = ai.text.chat(messages, **options)

# List available models
models = ai.text.models()

AudioGenerator

# Generate audio (returns bytes)
audio_data = ai.audio.generate(text, voice="alloy")

# Save audio to file
filepath = ai.audio.save(text, filename, voice="nova")

# List available voices
voices = ai.audio.voices()

🎨 Error Handling

Blossom AI provides beautiful, helpful error messages:

from blossom_ai import Blossom, BlossomError

ai = Blossom()

try:
    response = ai.text.generate("Hello")
except BlossomError as e:
    print(f"Error: {e.message}")
    print(f"Suggestion: {e.suggestion}")

📚 More Examples

Check out the tests/ directory for more detailed examples:

  • 01_audio_generation.py - audio generation examples
  • 02_image_generation.py - Image generation examples
  • 03_text_generation.py - Text generation examples

🔑 Authentication (Optional)

For higher rate limits and additional features:

  1. Visit auth.pollinations.ai
  2. Register your application
  3. Use tokens or referrers for authentication

📝 License

MIT License - see LICENSE file for details

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

🐛 Known Issues

  • Temperature parameter: The GET text endpoint doesn't support temperature. This is a limitation of the Pollinations.AI API
  • POST endpoint: Currently experiencing connectivity issues

🔗 Links

❤️ Credits

Built with love using the Pollinations.AI platform.


Made with 🌸 by the Blossom AI team

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

eclips_blossom_ai-0.1.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eclips_blossom_ai-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file eclips_blossom_ai-0.1.0.tar.gz.

File metadata

  • Download URL: eclips_blossom_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for eclips_blossom_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d852748b320c510c2a029f82a1a415355676e900288be9fbdf22cec9cd33e8ac
MD5 19d57e4d9cc545d3dcb0e0b18f0b045d
BLAKE2b-256 ea5101a6edff7e7be91bb037f65d89d17916adc8546b74a620a275d970d5b832

See more details on using hashes here.

File details

Details for the file eclips_blossom_ai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for eclips_blossom_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34d1d0e605ecaa5c03c9bf90976a93a34e5aef126198eb788e6c6ddbc3ec69b0
MD5 705032d08ebbf8e8cda48bd4353e7aad
BLAKE2b-256 3d6239efba5f3fdecabd0590a25beb9aa4262736a8c1382d34a0fff653387dd4

See more details on using hashes here.

Supported by

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