Tiny helper that calls the LLM7 image-generation endpoint and returns the final image URL.
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf3ac1f735b1056813c400025072d60a467bfd5a7da62ed3e5e5221952e57d79
|
|
| MD5 |
a46263748055b2d835b294c0a79330ab
|
|
| BLAKE2b-256 |
254773937ca9b4e6fece4a695567b16b7e43a72aa9a95fa0dc12257fdb142af9
|
File details
Details for the file llm7_image-2025.6.141317-py3-none-any.whl.
File metadata
- Download URL: llm7_image-2025.6.141317-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02bd8332ff715e5ae17a66852529849ff980d9c23fa8b63329cbd71c94ae251d
|
|
| MD5 |
d2c96cc59a55e0b0965a882616b97d16
|
|
| BLAKE2b-256 |
27b6aa1310b135c9779a0ad24a014c97df1e4438f75f41f1f3ab545be0926b2f
|