Endpoint · Images
Image Generation
Text-to-image API. Multiple leading models supported, output as URL or base64. Request shape matches OpenAI v1/images/generations.
Endpoint
httpPOST https://api.aicodedog.com/v1/images/generations
Popular models: nano-banana-pro (Google), seedream-4-5 (ByteDance), flux-1-1-pro (Black Forest Labs), gpt-image-1-5 (OpenAI).
Minimal request
curlcurl https://api.aicodedog.com/v1/images/generations \ -H "Authorization: Bearer $AICODEDOG_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nano-banana-pro", "prompt": "An orange tabby cat in a spacesuit sitting on the moon, photorealistic, soft sunlight", "size": "1024x1024", "n": 1 }'
pythonfrom openai import OpenAI client = OpenAI(api_key="<KEY>", base_url="https://api.aicodedog.com/v1") resp = client.images.generate( model="nano-banana-pro", prompt="A cherry-blossom illustration in front of Mt. Fuji, Ghibli style", size="1024x1024", n=1, ) print(resp.data[0].url)
Parameters
model(required) — model slug.prompt(required) — description. Supports Chinese and English; the more specific, the better.n— number of images, default 1. Up to 4 per request.size— resolution. Common:1024x1024/1536x1024(landscape) /1024x1536(portrait).quality—standard/hd(some models).style—vivid/natural(some models).response_format—url(default, temporary link valid 24 h) orb64_json(base64 — saves to disk immediately).seed— same prompt + same seed attempts reproducibility for style consistency (best-effort).negative_prompt— negative prompt (some models).
Response
json{ "created": 1747291200, "data": [ { "url": "https://cdn.aicodedog.com/img/abc123.png", "revised_prompt": "A photorealistic orange tabby cat..." } ] }
URLs expire in 24 hours
The default
response_format=url returns a temporary signed link. If you need long-term storage, download to your own object store (R2/S3/OSS) immediately — or use b64_json from the start to get base64 directly.Prompt tips
- Subject + style + details: first "what to draw", then "in what style", then "colour / light / composition".
- Avoid ambiguity: "a cat" might come back grey — specify "an orange short-haired tabby".
- Structure your sentences: split with periods or commas — the model parses more reliably.
- Style keywords: ink-wash, fine-line, Ghibli, cyberpunk, minimal line-art and friends all work.
- Negation pitfalls: avoid "not" / "without" unless via
negative_prompt.