Guishu GPT Image 2
Generate images through the Guishu Token OpenAI-compatible image endpoint.
Quick Start
Use the bundled script. It reads the API key from environment variables in this order:
LLM_TOKEN_API_KEYGUI_SHU_TOKEN_KEYOPENAI_API_KEY
export LLM_TOKEN_API_KEY="sk-..."
python3 {baseDir}/scripts/generate.py \
--prompt "a clean product poster for a blue smart speaker, studio lighting" \
--size 1024x1024 \
--quality high \
--n 1
The default endpoint is:
https://api.llm-token.cn/v1/images/generations
The default model is:
gpt-image-2
Workflow
- Read
references/gpt-image-2-api.mdwhen you need endpoint details, supported request fields, timeout guidance, or customer-facing setup notes. - Prepare one specific image prompt. Keep prompts concrete about subject, style, composition, camera, lighting, color, and output use.
- Run
scripts/generate.py. Prefer--response-format b64_jsonso the script can save files locally without depending on temporary URLs. - Inspect the saved output directory. The script writes generated images,
prompts.json,request.json, andindex.html. - If the request times out after a long wait, do not automatically retry. High-resolution requests can take 70-150 seconds and may still be billable upstream.
Useful Commands
# Dry-run without sending a billable request.
python3 {baseDir}/scripts/generate.py --prompt "test prompt" --dry-run
# Tall portrait.
python3 {baseDir}/scripts/generate.py \
--prompt "ultra realistic portrait photo, natural light, shallow depth of field" \
--size 1024x1792 \
--quality high
# Multiple prompts from a text file, one prompt per line.
python3 {baseDir}/scripts/generate.py --prompt-file ./prompts.txt --n 1
# Custom endpoint if the gateway changes.
python3 {baseDir}/scripts/generate.py \
--endpoint https://api.llm-token.cn/v1/images/generations \
--model gpt-image-2 \
--prompt "minimal app icon, white background"
Safety and Cost Notes
- Do not print API keys. Prefer environment variables over command-line
--api-key. - Avoid blind retries after long timeouts. Ask the user before retrying a request that may already have been processed.
- For casual users, recommend the web UI first:
https://image2.gpt-agent.cc/. - For automation or agent workflows, use the script and save local outputs.
