Skip to main content

PyPI version License: MIT Downloads LinkedIn

llm7_image

llm7_image is a minimal helper that calls the LLM7 image-generation endpoint and returns a final, ready-to-use image URL (either a CDN redirect or an inline data: URI). It performs parameter validation, handles redirects, and surfaces clear errors when the API says “no”.


Installation

pip install llm7-image

Quick start

from llm7_image import generate_image

TOKEN = "paste-your-token-here"          # Get a free token at https://token.llm7.io/

def main() -> None:
    prompt = "A beautiful landscape with mountains and a river."
    url = generate_image(prompt, token=TOKEN, w=800, h=600, model=2)
    print(url)                           # → https://wsrv.nl/?url=https://api.llm7.io/i/abc123.jpeg…

if __name__ == "__main__":
    main()

If the image is streamed directly (rare), the helper returns an inline Base64-encoded data: URI instead of a redirect URL, so you can drop it straight into an <img> tag.


Parameters

Argument Range / Options Default Notes
prompt 1 – 10 000 chars — Text prompt for the model.
token valid LLM7 token — Required; obtain one for free.
w, h 100 – 1500 px 1000 Output dimensions.
seed 0 – 1 000 000 000 0 RNG seed.
model 1 or 2 1 Diffusion model version.
timeout (connect, read) tuple or float (5, 300) Passed to requests.get.

Invalid values raise ValueError. Non-2xx API responses raise GenerationError with the server’s message.


Why use this helper?

  • Zero boilerplate – one call, one URL.
  • Strict validation – catch mistakes before they hit the network.
  • Friendly errors – clear messages instead of cryptic HTTP codes.
  • Tiny footprint – only dependency is requests.

Contributing

Bug reports, ideas, and pull requests are welcome! Open an issue or PR on the GitHub repo.


License

llm7_image is released under the MIT License.

Metadata

Release files for llm7-image 2025.6.141317

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

Source distribution (sdist)

Source distribution for llm7-image 2025.6.141317
File Size Uploaded
llm7_image-2025.6.141317.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm7-image 2025.6.141317
File Interpreter ABI Platform
llm7_image-2025.6.141317-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / llm7_image-2025.6.141317.tar.gz

Download URL llm7_image-2025.6.141317.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cf3ac1f735b1056813c400025072d60a467bfd5a7da62ed3e5e5221952e57d79
BLAKE2b-256 checksum
How to use checksums
254773937ca9b4e6fece4a695567b16b7e43a72aa9a95fa0dc12257fdb142af9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Release files / llm7_image-2025.6.141317-py3-none-any.whl

Download URL llm7_image-2025.6.141317-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02bd8332ff715e5ae17a66852529849ff980d9c23fa8b63329cbd71c94ae251d
BLAKE2b-256 checksum
How to use checksums
27b6aa1310b135c9779a0ad24a014c97df1e4438f75f41f1f3ab545be0926b2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Release history Release notifications | RSS feed

This release

2025.6.141317 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