What does llamport-image do?
Make and edit images with codex/gpt-image-2 on llamport (https://api.llamport.com). Each call
returns the image bytes, so curl -o saves the file and -w prints one result
line; no jq or base64 needed.
Key
KEY="${LLAMPORT_API_KEY:-$(llamport token)}"
Never print the key.
Generate
mkdir -p images
curl --fail-with-body -sS -H "Accept: image/png" -H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"model":"codex/gpt-image-2","prompt":"A red house on a green hill at sunset"}' \
https://api.llamport.com/v1/images/generations -o images/red-house.png \
-w '%{http_code} %{content_type} %{size_download}\n'
Optional JSON fields: size (such as 1024x1024, 1536x1024, 1024x1536),
quality (low, medium, high), background (transparent, opaque).
Upstream may ignore size; also name the shape in the prompt
(e.g. 'Portrait image.').
Edit
Send the image to change as a file, one -F "image[]=@…" per input image:
curl --fail-with-body -sS -H "Accept: image/png" -H "Authorization: Bearer $KEY" \
-F model=codex/gpt-image-2 -F "prompt=Make the roof blue" \
-F "image[]=@images/red-house.png" \
https://api.llamport.com/v1/images/edits -o images/red-house-blue-roof.png \
-w '%{http_code} %{content_type} %{size_download}\n'
Windows
Run the same commands with curl.exe (not the PowerShell curl alias). Set the
key with $KEY = if ($env:LLAMPORT_API_KEY) { $env:LLAMPORT_API_KEY } else { llamport token },
and pass the JSON body from a file (-d "@request.json") to avoid quoting problems.
End continued lines with a backtick (`) instead of \, and keep the -w
format in single quotes, which PowerShell passes as written.
Rules
- One image per call. For several images, make several calls.
- No
mask: describe the change in the prompt instead. - Save to the path the user asked for; otherwise to
./images/<slug>.png, where<slug>is a short kebab-case name from the prompt. Tell the user the path. - Read the result line, not curl's silence:
200 image/png 1301711(status, type, bytes) means the image was saved to the-opath. Any other status means the call failed and the-ofile, if any, holds a JSON error instead of the image: read it, then delete that file. image_quota_exhausted: wait for the seconds in theRetry-Afterheader (add-D -to print the headers), then try again.insufficient_credit: stop and tell the user to add credit on llamport.