Skip to main content

Tiny helper that calls the LLM7 image-generation endpoint and returns the final image URL.

Project description

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.

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

llm7_image-2025.6.141317.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

llm7_image-2025.6.141317-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file llm7_image-2025.6.141317.tar.gz.

File metadata

  • Download URL: llm7_image-2025.6.141317.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.11

File hashes

Hashes for llm7_image-2025.6.141317.tar.gz
Algorithm Hash digest
SHA256 cf3ac1f735b1056813c400025072d60a467bfd5a7da62ed3e5e5221952e57d79
MD5 a46263748055b2d835b294c0a79330ab
BLAKE2b-256 254773937ca9b4e6fece4a695567b16b7e43a72aa9a95fa0dc12257fdb142af9

See more details on using hashes here.

File details

Details for the file llm7_image-2025.6.141317-py3-none-any.whl.

File metadata

File hashes

Hashes for llm7_image-2025.6.141317-py3-none-any.whl
Algorithm Hash digest
SHA256 02bd8332ff715e5ae17a66852529849ff980d9c23fa8b63329cbd71c94ae251d
MD5 d2c96cc59a55e0b0965a882616b97d16
BLAKE2b-256 27b6aa1310b135c9779a0ad24a014c97df1e4438f75f41f1f3ab545be0926b2f

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