Skip to main content
Pre-release

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")

Provider configuration file

Provider defaults live in src/simple_chatbot_imaging/providers.json. You can edit that file to change API endpoints, model IDs, or add your own providers without changing library code.

{
  "openrouter": {
    "kwargs": {
      "base_url": "https://openrouter.ai/api/v1/images",
      "model": "meta/muse-image",
      "api_key_env": "OPENROUTER_API_KEY"
    }
  },
  "custom_provider": {
    "factory": "your_package.providers:YourCustomProvider",
    "kwargs": {
      "base_url": "https://example.com/api/v1/images",
      "api_key_env": "CUSTOM_API_KEY"
    }
  }
}

You can also pass a custom config path explicitly:

from simple_chatbot_imaging import create_image_generator

gen = create_image_generator(
    "openrouter",
    config_path="./providers.json",
    base_url="https://example.com/api/v1/images",
)

OpenRouter (openrouter)

  • Uses the OpenRouter images/generations API via httpx (native async).
  • Requires the OPENROUTER_API_KEY environment variable.
  • Options: model (default meta/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_TOKEN if set.
  • Options: space_id (default hugging-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.0b3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-chatbot-imaging 1.0.0b3
File Size Uploaded
simple_chatbot_imaging-1.0.0b3.tar.gz 37.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-chatbot-imaging 1.0.0b3
File Interpreter ABI Platform
simple_chatbot_imaging-1.0.0b3-py3-none-any.whl Python 3 none any Details

Total release size: 56.5 kB

Release files / simple_chatbot_imaging-1.0.0b3.tar.gz

Download URL simple_chatbot_imaging-1.0.0b3.tar.gz
Size 37.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b0a81260299fb65c2ec4d6aa24143d521a965577260bfa93be61748dc3438bc8
BLAKE2b-256 checksum
How to use checksums
8b2dbea7d04e532ded2846d2c23e78ced2c6a79a8b04f7db4451422602a44d86
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 27, 2026.

Transparency log

Release files / simple_chatbot_imaging-1.0.0b3-py3-none-any.whl

Download URL simple_chatbot_imaging-1.0.0b3-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a54cf7e2758974290b6f6a5a1f5f13b4cdb862d5420cada4ff8a4d9dcd1d4523
BLAKE2b-256 checksum
How to use checksums
00fcf0ea9aa84c414a75ec62e53c5e96756b75ba28caf97934ed64e23832ef43
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 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0b3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page