This release is a pre-release and may not be stable for production use.
simple-chatbot-imaging
Standalone image generation package with pluggable providers, opt-in fallback orchestration, and a true async API.
Installation
uv add simple-chatbot-imaging # core + OpenRouter provider
uv add "simple-chatbot-imaging[huggingface]" # + Hugging Face provider
uv add "simple-chatbot-imaging[all]" # everything
The fallback extra enables fallback orchestration only; install the provider
extras you want in the chain yourself (e.g. [huggingface]).
Quick start
from simple_chatbot_imaging import create_image_generator
gen = create_image_generator("openrouter", media_path="media")
path = await gen.generate_image_async("a neon cyberpunk city at night")
Synchronous use:
path = gen.generate_image("a neon cyberpunk city at night")
Providers
OpenRouter (openrouter)
- Uses the OpenRouter
images/generationsAPI viahttpx(native async). - Requires the
OPENROUTER_API_KEYenvironment variable. - Options:
model(defaultmeta/muse-image),base_url,api_key_env,request_timeout_seconds.
Hugging Face (huggingface, extra: huggingface)
- Runs a Gradio Space (ZeroGPU) via
gradio-client. - Uses
HUGGINGFACE_ACCESS_TOKENif set. - Options:
space_id(defaulthugging-apps/qwen-image-2-1),hf_token_env.
Fallback (opt-in)
Fallback is never implicit. Build it explicitly with a caller-defined chain:
from simple_chatbot_imaging import FallbackImageGenerator, create_image_generator
providers = [create_image_generator("openrouter"), create_image_generator("huggingface")]
gen = FallbackImageGenerator(generators=providers)
Each provider runs its full lifecycle (retries, state, output movement); the fallback only advances to the next provider on failure.
API
BaseImageGenerator— abstract provider base; prompt validation, retries with backoff, timeouts, state tracking, output movement.generate_image(...)— synchronous entry point.generate_image_async(...)— true async entry point (native async providers).ImageGenerationError(retryable=...)— permanent errors (bad key, no credits, 403/404) are not retried.ImageGenerationState—IDLE,GENERATING,ERROR,SUCCESS.create_image_generator(provider, **kwargs)— factory; raises a clear error when an optional provider's extra is not installed.register_provider(name, factory)— plugin hook.
Environment variables
| Variable | Provider | Required |
|---|---|---|
OPENROUTER_API_KEY |
openrouter | yes |
HUGGINGFACE_ACCESS_TOKEN |
huggingface | no (recommended for ZeroGPU spaces) |
Release files for simple-chatbot-imaging 1.0.0b2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simple_chatbot_imaging-1.0.0b2.tar.gz | 26.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_chatbot_imaging-1.0.0b2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.9 kB
Release files / simple_chatbot_imaging-1.0.0b2.tar.gz
| Download URL | simple_chatbot_imaging-1.0.0b2.tar.gz |
|---|---|
| Size | 26.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e307cc9eb73e700507a124c16d93b122b2f91161739fc9122aa5e93800004d8
|
|
BLAKE2b-256 checksum How to use checksums |
534e7fcec74816882776658e003c415517843468b712685c40daf4f349a1419a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / simple_chatbot_imaging-1.0.0b2-py3-none-any.whl
| Download URL | simple_chatbot_imaging-1.0.0b2-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e1e576097898398afee199606fddffa28473035d61537a5439474c29b5d8e95
|
|
BLAKE2b-256 checksum How to use checksums |
8eb68ebe9fbf7cca2d73bb79d691c40ee499c177a88e858b318abb46b46bf5ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log