Same model, better output: what consumer image apps add on top of the API — a prompt rewrite layer, reference anchoring, parallel sampling with vision-model selection, and step-by-step retouching. Includes copy-paste realism vocabulary, side-by-side tests, and the cost math.
How to Get the Image You Want answers “this one attempt failed, how do I rescue it.” This page answers the next question: how do I make every attempt land.A question that comes up constantly: consumer image products like freepik.com and higgsfield.ai run on the same base models you do — the same Nano Banana, GPT-Image and FLUX families — yet their output looks more finished. The gap is not in the model weights. It is the layer wrapped around the model, and you can build that layer yourself. This page shows how.
Call a text model to rewrite first, then hit the image model (section 2)
Style presets (dozens of clickable presets, plus saved custom ones)
Freezes an aesthetic so users need no photography vocabulary
A preset is just a prompt-fragment constant in your code plus a fixed set of reference images
Identity anchoring (e.g. Higgsfield’s Soul ID, which trains a persistent identity on 20–80 photos)
Same person stays the same across generations
Approximate it with reference images (see the boundaries below)
Sampling several, showing one
The user only ever sees the best candidate, so the perceived hit rate approaches 100%
Generate N in parallel, then let a vision model score and pick (section 3, steps 3–4)
Step-by-step editing
Compound instructions in one shot reliably break down
Lock composition first, then edit locally, then add text
Upscaling and post-processing (Freepik acquired Magnific in 2024, offering 2×–16× creative upscaling)
Turns small output into print-ready sizes
APIYI has no such endpoint — generate at the high resolution tier instead (see boundaries below)
Negative prompts and safety fallbacks
Steers around known model habits, and catches requests moderation would reject
Bake fixed negative phrasing into your template, plus a downgrade path for moderation failures
Asset library and rehosting
User images never expire or disappear
Copy every result into your own object storage immediately
Two platform boundaries to settle before you copy a competitor’s feature list:
APIYI has no upscaling, background-removal, or face-restoration endpoint. If you need a large image, pick the high resolution tier at generation time (gpt-image-2 at 4K, Nano Banana Pro at 4K) rather than planning to enlarge afterwards. For a transparent background, use official-relay gpt-image-2.5-flare / gpt-image-2.5-sunburst with background: "transparent" — it returns PNG with a real alpha channel (OpenAI shut transparency down for gpt-image-2 on 2026-09-30) (seedream-5-0 / seedream-5-0-pro can only be prompted, and alpha is not guaranteed on every call). See How do I generate images with a transparent background.
APIYI does not offer LoRA or identity training. The “train once, lock the face forever” capability behind Soul ID can only be approximated with reference images: the same character will still drift across scenes and lighting changes, and holds best when the new shot stays close to a frontal view and the original lighting. For commercial characters that demand strict consistency, budget for a human review step.
Side-by-side test: one model, one brief, two prompts
The brief is “an e-commerce product shot for coffee.” On the left is what a user actually types; on the right is the same brief with the missing decisions filled in. Both ran once on gemini-3-pro-image (Nano Banana Pro) at 2K, 1:1:
Casual prompt: 'Make me a coffee product shot, make it look nice, make it feel premium'
Structured prompt: subject, environment, light position, lens, grading, imperfections and composition all specified
The left image is not ugly, but it is unusable. The model made a pile of decisions nobody authorized: it added a grinder and a burlap sack, settled on nostalgic warm grading, and printed an invented brand name on the cup — auto-generated text like that makes the frame worthless commercially. The right image can go straight onto a product page: neutral background, a light setup you can describe out loud, and room for copy.“Looks nice” and “is usable” are different targets. A casual prompt can only reach the first one.
Rewriting does not mean making the prompt longer. It means filling in missing decisions. An image prompt has six load-bearing parts:
Element
What happens without it
Example
Subject
The model improvises and adds props you did not want
”A matte black ceramic pour-over cup, filled to 80% with black coffee”
Environment
Random backgrounds, so a set of images never matches
”Light grey microcement surface, wall in the same tone, blurred”
Light
Flat global illumination that reads as fake instantly
”Key light from a softbox at upper left, 45 degrees; white bounce card on the right”
Lens and angle
Perspective and depth of field are out of your control
”85mm macro, f/5.6, front view angled 15 degrees down”
Grading and medium
Defaults to saturated, rendered-looking output
”Cool neutral white balance, low overall saturation”
Composition
The subject is always dead centre
”Cup on the left third of the frame, large negative space to the right”
Resolution is not a seventh element. Output resolution comes only from parameters such as size / imageSize; writing “4K” or “8K” in the prompt does not add a single pixel. See Image Compression and Output Resolution.
A cheap, fast text model is enough here; its cost is negligible next to generation:
import osimport requestsBASE = "https://api.apiyi.com/v1"API_KEY = os.environ["APIYI_API_KEY"] # never hard-code the keyREWRITE_SYSTEM = """You are an image prompt engineer. Rewrite the user's casual briefinto one structured image prompt.Fill in all six elements. Supply whatever is missing; never ask the user:1 Subject: material, colour, count, state2 Environment: what the background is, what is sharp and what is blurred3 Light: direction, hardness, fill or no fill — there must be one identifiable key light4 Lens and angle: focal length, aperture, camera height, tilt5 Grading and medium: white balance bias, saturation, film or digital character6 Composition: where the subject sits in the frame, where the negative space isRules:- Output only the prompt body: no explanation, no bullet points, no heading- No brand names, logos, or legible text unless the user asked for them- Never use vague quality words such as 8K, ultra HD, masterpiece, perfect- Keep any element the user specified exactly as written"""def rewrite(user_prompt: str) -> str: r = requests.post( f"{BASE}/chat/completions", headers={"Authorization": f"Bearer {API_KEY}"}, json={ "model": "gemini-3.5-flash", "messages": [ {"role": "system", "content": REWRITE_SYSTEM}, {"role": "user", "content": user_prompt}, ], }, timeout=60, ) r.raise_for_status() return r.json()["choices"][0]["message"]["content"].strip()
Chain the remaining four layers onto the rewrite layer and you have the whole thing:
1
Rewrite: casual input to structured prompt
See section 2. This step also neutralizes sensitive content in user input along the way, which measurably reduces how often the request is blocked downstream.
2
Anchor: reference images plus a style constant
Style is pinned by two things: a style constant appended to every prompt (your preset), and a fixed set of reference images.Reference limits differ sharply by family — confirm yours before you design the pipeline:
input_image_2 … input_image_8; klein takes 4, Kontext takes 1
Grok Imagine
1–4
A fifth image returns 400
Two rules to respect: “image 1 / image 2” in the prompt map strictly to array order, so state explicitly which is which; and Grok only honours reference images on /v1/images/edits — passing them to /v1/images/generations silently discards them and still bills you.
3
Sample: generate N in parallel, do not rely on n
The “it nailed it first try” feel of a consumer product is really the product drawing several cards on your behalf.But the server-side n parameter has no effect on most image models (Seedream ignores it outright). To get multiple candidates, fire multiple requests concurrently from the client — the skill pages on this site cap it at 5 at a time. Tune concurrency per channel; some start returning 429 at 2, so add exponential backoff.
4
Select: use a vision model as the judge
Once you have N candidates you must pick automatically, otherwise you have simply pushed the choice onto the user.Send the candidates back to a vision model for scoring over the standard /v1/chat/completions image input; see Vision Understanding for eligible models. Fix the rubric at five dimensions and demand JSON back: instruction compliance, structure and anatomy, text correctness, texture realism, composition.
Do not use /v1/rerank for this. bge-reranker-v2-m3 is a text-only reranking model and does not accept images. Scoring images requires a vision understanding model.
5
Retouch and land it
Adjust locally after the composition is settled — far higher success rate than one compound instruction:
Pixel-level local repaint: only the official-relay gpt-image-2 supports masks; see Mask Inpainting Guide.
Multi-turn cumulative editing: supported on the native Gemini endpoint for Nano Banana models (feed the previous image back as role: "model"); the reverse-engineered routes do not support it.
Rehost immediately: every returned URL is temporary (FLUX about 10 minutes and without CORS; Seedream and R2 about 24 hours), so download into your own object storage as soon as you have it.
import base64import jsonimport osfrom concurrent.futures import ThreadPoolExecutorimport requestsBASE = "https://api.apiyi.com"API_KEY = os.environ["APIYI_API_KEY"]HEAD = {"Authorization": f"Bearer {API_KEY}"}STYLE_CONST = "Cool neutral white balance, low saturation, clean frame with generous negative space."def draw(prompt: str, size: str = "2K", aspect: str = "1:1") -> bytes: """Generate one image (Nano Banana Pro, native Gemini endpoint).""" url = f"{BASE}/v1beta/models/gemini-3-pro-image:generateContent" body = { "contents": [{"parts": [{"text": prompt}]}], "generationConfig": { "responseModalities": ["IMAGE"], "imageConfig": {"aspectRatio": aspect, "imageSize": size}, }, } r = requests.post(url, headers=HEAD, json=body, timeout=600) # headroom for 4K r.raise_for_status() parts = r.json()["candidates"][0]["content"]["parts"] part = next((p for p in parts if p.get("inlineData")), None) if part is None: # HTTP 200 with no image usually means moderation raise RuntimeError("no image returned: " + json.dumps(parts)[:300]) return base64.b64decode(part["inlineData"]["data"])def score(image: bytes, prompt: str) -> dict: """Score a candidate with a vision model; returns per-dimension scores and one issue line.""" data_url = "data:image/png;base64," + base64.b64encode(image).decode() rubric = ( "Score this image and return strict JSON: " '{"instruction":0-10,"anatomy":0-10,"text":0-10,"texture":0-10,' '"composition":0-10,"total":0-50,"issue":"one sentence"}. ' "instruction = does it satisfy the brief below; anatomy = errors in hands, limbs, object structure; " "text = is any text in the image correct (score 10 if there is none); " "texture = does it read as a real photograph rather than a render; " "composition = is the framing usable. The brief:\n" + prompt ) r = requests.post( f"{BASE}/v1/chat/completions", headers=HEAD, json={ "model": "gemini-3.5-flash", "messages": [{"role": "user", "content": [ {"type": "text", "text": rubric}, {"type": "image_url", "image_url": {"url": data_url}}, ]}], "response_format": {"type": "json_object"}, }, timeout=120, ) r.raise_for_status() return json.loads(r.json()["choices"][0]["message"]["content"])def best_of(user_input: str, n: int = 4) -> bytes: prompt = rewrite(user_input) + "\n" + STYLE_CONST # steps 1 and 2 with ThreadPoolExecutor(max_workers=n) as pool: # step 3: client-side fan-out results = list(pool.map(lambda _: _safe(draw, prompt), range(n))) cands = [img for ok, img in results if ok] if not cands: raise RuntimeError("all candidates failed; check moderation or fall back to another model") with ThreadPoolExecutor(max_workers=len(cands)) as pool: # step 4: score in parallel scores = list(pool.map(lambda im: score(im, prompt), cands)) ranked = sorted(zip(cands, scores), key=lambda x: x[1]["total"], reverse=True) return ranked[0][0] # step 5 retouch/rehost hooks in heredef _safe(fn, *args): try: return True, fn(*args) except Exception as e: # one failure must not sink the batch return False, str(e)
Same model (gemini-3-pro-image), same subject, two prompt styles, two images each, first one shown from each batch:
Bare prompt: 'A photorealistic half-body portrait of a young woman by a cafe window, smiling at the camera, 8K, ultra HD, ultra detailed, flawless skin, beautiful, perfect lighting, masterpiece'
The same subject after adding four blocks of control language: light position, lens, medium, imperfections
The left image is not bad — the base model is strong enough that a bare prompt still yields a good-looking picture. But it carries the full trait set: the subject is locked dead centre, the light is so even you cannot say where it comes from, and every element is agreeable. And it is not a fluke: both images from that batch shared essentially the same framing and lighting pattern.The right image switched approach: the light has a direction, half the face is allowed to fall into shadow, skin shows oil and pores, there is a mole on the cheek, stray hairs are unbrushed, and the subject sits right of centre. It reads as a specific person photographed at a specific moment, rather than “stock image of woman smiling in cafe.”
This is also where the real value of a pipeline shows. It does not turn ugly output into pretty output — it turns “lucky good” into “the good you specified, can describe, and can reproduce.” A stakeholder might not prefer the right image, but with the left one you cannot say why it looks the way it does, and you cannot ask the next image to match it.
Specify placement: “subject right of centre, negative space at left"
"perfect composition”, “golden ratio”
Plastic skin with no pores
”natural skin texture, visible pores and facial fuzz, slight shine on the nose, no retouching"
"flawless skin”, “exquisite”, “beautiful”
Even light with no identifiable source
Name one key light and its hardness: “window light from the left is the only source, right half of the face in shadow"
"perfect lighting”, “soft lighting”
Fake depth of field, background looks pasted on
Give focal length and aperture: “85mm, f/2.8, focus on the near eye"
"blurred background”, “cinematic”
Oversaturated, glowing colour
Give medium and white balance: “Kodak Portra 400 character, warm highlights and cool shadows, low saturation"
"vivid colours”, “HDR”
Everything brand new and unworn
Add wear deliberately: “pilled sweater, water rings and crumbs on the table"
"clean and tidy”, “premium texture”
Reads like a poster or a render
Specify the shooting situation: “candid”, “eye level from the next table"
"8K”, “ultra HD”, “masterpiece”
Vague quality words such as 8K, ultra HD, ultra detailed, masterpiece and perfect are a net negative. They add no resolution (only parameters do that) and they push the model toward an over-sharpened, oversaturated render — precisely the core of the AI look. The left-hand prompt above was stuffed with them, and the result shows it. If you want quality, write specific light, lens and medium instead.
Mix into the prompt as needed; one or two lines from each block is usually enough:
Light
window light from the left is the only source in frame / hard back-side light at three in the afternoon / backlit, with a rim light on the hair / a desk lamp as a practical light inside the frame / overcast diffuse light with no distinct shadows
Lens
35mm f/2.0, candid, at eye level / 85mm f/2.8, focus on the near eye / 24mm from a low camera position, slight edge distortion / long lens compressing the space, flattened background layers / mild vignetting in the corners
Medium
Kodak Portra 400 character, fine grain / warm highlights, cool shadows / Polaroid instant film, low contrast, soft edges / noise and colour cast of an early CCD digital camera / low saturation overall, no sharpening
Imperfections
natural skin texture, visible pores and facial fuzz / a few loose strands of hair, unbrushed / pilled sweater, worn cuffs / water rings, fingerprints and crumbs on the table / off-centre framing, part of the subject cropped at the edge
Candid half-body portrait: a woman in her mid-twenties by a cafe window, turned to the side, looking out, a smile she is not quite holding back. Window light from the left is the only source in the frame; the right half of her face falls into shadow, with a small hard-edged shadow under the bridge of her nose. 85mm lens, f/2.8, eye level, focus on the near eye. Kodak Portra 400 character with fine visible grain, warm highlights and cool shadows, low saturation overall. Natural skin: visible pores and facial fuzz, a little shine on the side of the nose, a small mole on the left cheek, a few stray eyebrow hairs, loose strands of hair unbrushed at the forehead. No skin smoothing, no beauty retouching, no sharpening. Subject right of centre, negative space at left.
Product shot: ready for a product page
E-commerce hero shot: a matte black ceramic pour-over cup filled to 80% with black coffee, a fine ring of crema on the surface. It sits on a light grey microcement surface, with a wall in the same tone blurred behind it. Key light from a softbox at upper left, 45 degrees; a white bounce card at the right leaves a narrow highlight along the right edge of the cup; a soft cast shadow falls to the rear right. 85mm macro lens, f/5.6, front view angled 15 degrees down, the whole cup sharp. Cool neutral white balance, low saturation overall. The glaze has slight handmade unevenness and one tiny kiln mark, and the rim shows a very faint trace of use. Generous negative space, cup on the left third of the frame. No brand names or text anywhere in the image.
Environment: give it a specific time and weather
A narrow old-town street at six in the evening, just after rain, puddles reflecting the light boxes of the shops on both sides. The only key light is a warm street lamp at the end of the street, with shop windows as fill, and a trace of cold dusk still in the sky, setting up a warm-cool contrast. 28mm lens, f/4, camera at eye level, tilted slightly up. Low saturation overall, noise retained in the shadows, no shadow lifting. The walls carry water stains, torn old posters and air-conditioning units; power lines cross the upper part of the frame. Nobody faces the camera; the passers-by are seen from behind and slightly motion blurred.
Seed is effectively unavailable across this product line: no Nano Banana or GPT-Image model exposes a seed, Seedream 4.x / 5.x seeds have been measured as ineffective, and Grok Imagine does not support one
Do not build reproducibility on seeds. The only reliable reproduction is archiving the full successful request — prompt, reference images, every parameter — and replaying it verbatim
The server-side n parameter has no effect on most image models
Multiple candidates must come from client-side concurrency; load-test the concurrency per channel and add exponential backoff
All image APIs are synchronous, have no task ID, and still bill on disconnect
No upscaling, background-removal, or face-restoration endpoint
Settle the output size at generation time; for a transparent background pass background: "transparent" to gpt-image-2.5-flare / gpt-image-2.5-sunburst (not a cutout endpoint — it generates on transparency directly)
HTTP 200 with no image usually means a moderation block
Selection logic must distinguish “no image came back” from “an image came back and it is bad”; for the former see Gemini Image Error Handling
Every returned image URL is a temporary link
Rehost the moment you receive it; never store the upstream URL in your database
GPT-Image prompts are capped at 8,192 tokens (measured; no error when exceeded, the whole prompt is silently ignored; about 11,000 Chinese characters)
Do not paste brand books or packaging specs straight into the image model; distill them with a text model into a 1K to 3K character structured prompt first, see Long Prompts
A pipeline trades money for success rate. Output dominates image cost (gpt-image-2 bills output at $30 per million tokens), while the text and vision models used for rewriting and scoring are close to noise. So cost is essentially “how many candidates did you generate.”Use three tiers rather than one setting for everything:
Tier
Composition
Relative cost
Use for
Draft
Single shot from a Lite model
1×
Internal previews, bulk placeholders, casual user experiments
Standard
Rewrite + 2 candidates + scored pick
about 2×
The default path in a consumer product
Premium
Rewrite + 4 candidates + scoring + one local retouch
about 5×
Product hero images, ad creative, anything delivered externally
The test is simple: will anyone outside your team see this image? If yes, Standard or above pays for itself; if it is an internal glance, Draft is enough. You can also add a gate in between — only generate more candidates when the top score falls below a threshold, which lets most requests converge at two.
The gap is not in the model weights, it is in the eight layers around the model: rewrite, presets, anchoring, sampling, selection, step-by-step editing, post-processing, rehosting.
The rewrite layer has the best return: fill in subject, environment, light, lens, grading and composition, and “looks nice” becomes “is usable.”
Multiple candidates plus vision-model scoring is where the high perceived success rate of consumer products actually comes from. n does not work, so fan out client-side; /v1/rerank cannot score images.
Removing the AI look means adding specifics, not adjectives: name one light source, give focal length and aperture, specify medium and grain, add imperfections on purpose, and move the subject off centre.
8K / masterpiece / perfect lighting are net negatives — no extra resolution, and they push the frame toward a rendered look.
Do not count on seeds for reproduction; archive the full request instead. Image APIs are synchronous and bill on disconnect, so the pipeline needs a queue.
APIYI has no upscaling, background-removal, or identity-training endpoints; design around those layers from the start.
Pixel-level local edits, exclusive to the official-relay gpt-image-2
Multi-Image Fusion Testing
How reference limits were measured, plus a 14-image fusion result
Vision Understanding
Vision models you can use to score candidate images, and how to call them
Build Your Own Async Queue
Wrapping synchronous generation in a task queue to support a multi-candidate pipeline
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"API易文档中心","description":"企业级专业稳定的AI大模型API中转站,一个令牌、无限模型。支持OpenAI、Claude、Gemini、DeepSeek、Qwen等 200+ 精选 AI 模型。","colors":{"primary":"#2563eb","light":"#3b82f6","dark":"#1d4ed8"},"logo":{"light":"https://mintcdn.com/apiyillc/LjCT1O0GrSur6F2v/logo/light.svg?fit=max\u0026auto=format\u0026n=LjCT1O0GrSur6F2v\u0026q=85\u0026s=4119ef17a74cc54be127f34578d8b5fa","dark":"https://mintcdn.com/apiyillc/LjCT1O0GrSur6F2v/logo/dark.svg?fit=max\u0026auto=format\u0026n=LjCT1O0GrSur6F2v\u0026q=85\u0026s=1f046ae9580247d96549ade642b5ecc4"},"favicon":"https://mintcdn.com/apiyillc/OMY6ItCc2mC1yzgA/logo/logo.webp?fit=max\u0026auto=format\u0026n=OMY6ItCc2mC1yzgA\u0026q=85\u0026s=62a7977ef801070e689df2d0291b9d13","api":{"openapi":["api-reference/nano-banana-2-generate-openapi.yaml","api-reference/nano-banana-2-edit-openapi.yaml","api-reference/nano-banana-2-generate-openapi-en.yaml","api-reference/nano-banana-2-edit-openapi-en.yaml","api-reference/nano-banana-pro-generate-openapi.yaml","api-reference/nano-banana-pro-edit-openapi.yaml","api-reference/nano-banana-pro-generate-openapi-en.yaml","api-reference/nano-banana-pro-edit-openapi-en.yaml","api-reference/gpt-image-2-all-generate-openapi.yaml","api-reference/gpt-image-2-all-edit-openapi.yaml","api-reference/gpt-image-2-all-generate-openapi-en.yaml","api-reference/gpt-image-2-all-edit-openapi-en.yaml","api-reference/gpt-image-2-all-chat-openapi.yaml","api-reference/gpt-image-2-all-chat-openapi-en.yaml","api-reference/gpt-image-2-vip-generate-openapi.yaml","api-reference/gpt-image-2-vip-edit-openapi.yaml","api-reference/gpt-image-2-vip-chat-openapi.yaml","api-reference/gpt-image-2-vip-generate-openapi-en.yaml","api-reference/gpt-image-2-vip-edit-openapi-en.yaml","api-reference/gpt-image-2-vip-chat-openapi-en.yaml"],"playground":{"display":"interactive","proxy":true},"examples":{"defaults":"required"}},"navbar":{"links":[{"href":"https://api.apiyi.com","label":"首页"},{"href":"https://imagen.apiyi.com","label":"AI出图"},{"href":"https://icover.ai","label":"AI视频"}],"primary":{"type":"button","label":"控制台","href":"https://api.apiyi.com/account/profile"}},"footer":{"socials":{"website":"https://api.apiyi.com"},"links":[{"header":"AI 集成","items":[{"label":"skill.md","href":"https://docs.apiyi.com/skill.md"},{"label":"llms.txt","href":"https://docs.apiyi.com/llms.txt"},{"label":"llms-full.txt","href":"https://docs.apiyi.com/llms-full.txt"},{"label":"model-registry.json","href":"https://docs.apiyi.com/model-registry.json"},{"label":"AI 开发者套件(中文)","href":"/developer-kit"},{"label":"AI Developer Kit (EN)","href":"/en/developer-kit"}]},{"header":"用户口碑 / Wall of Love","items":[{"label":"用户口碑(中文)","href":"/wall-of-love"},{"label":"Wall of Love (EN)","href":"/en/wall-of-love"}]}]},"seo":{"indexing":"all"},"icons":{"library":"lucide"},"banner":{"content":"🚀 **GPT Image 2.6 Sunburst 和 Flare 均已上线,支持 GIF 输出,低至 83 折(17% off) | Now Live**:[详情 Details](https://docs.apiyi.com/api-capabilities/gpt-image-2/gpt-image-2-6)","dismissible":true},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","aistudio"],"display":"header"},"metadata":{"timestamp":false},"styling":{"latex":true},"navigation":{"global":{"anchors":[]},"languages":[{"language":"zh","href":""},{"language":"en","navbar":{"links":[{"href":"https://api.apiyi.com","label":"Home"},{"href":"https://imagen.apiyi.com","label":"AI Image"},{"href":"https://icover.ai","label":"AI Video"}],"primary":{"type":"button","label":"Console","href":"https://api.apiyi.com/account/profile"}},"href":"en"},{"language":"zh-Hant","banner":{"content":"本頁由程式自動轉換為繁體中文,用詞以台灣正體為準;如有歧義請以[簡體中文版](/)為準。","dismissible":true},"footer":{"socials":{"website":"https://api.apiyi.com"},"links":[{"header":"AI 整合","items":[{"label":"skill.md","href":"https://docs.apiyi.com/skill.md"},{"label":"llms.txt","href":"https://docs.apiyi.com/llms.txt"},{"label":"llms-full.txt","href":"https://docs.apiyi.com/llms-full.txt"},{"label":"model-registry.json","href":"https://docs.apiyi.com/model-registry.json"},{"label":"AI 開發者套件(中文)","href":"/developer-kit"},{"label":"AI Developer Kit (EN)","href":"/en/developer-kit"}]},{"header":"使用者口碑 / Wall of Love","items":[{"label":"使用者口碑(中文)","href":"/wall-of-love"},{"label":"Wall of Love (EN)","href":"/en/wall-of-love"}]}]},"navbar":{"links":[{"href":"https://api.apiyi.com","label":"首頁"},{"href":"https://imagen.apiyi.com","label":"AI出圖"},{"href":"https://icover.ai","label":"AI影片"}],"primary":{"type":"button","label":"控制台","href":"https://api.apiyi.com/account/profile"}},"href":"zh-Hant"},{"language":"ja","banner":{"content":"このページは AI により翻訳されています。内容に相違がある場合は[English 版](/en)を正としてください。","dismissible":true},"footer":{"socials":{"website":"https://api.apiyi.com"},"links":[{"header":"AI統合","items":[{"label":"skill.md","href":"https://docs.apiyi.com/skill.md"},{"label":"llms.txt","href":"https://docs.apiyi.com/llms.txt"},{"label":"llms-full.txt","href":"https://docs.apiyi.com/llms-full.txt"},{"label":"model-registry.json","href":"https://docs.apiyi.com/model-registry.json"},{"label":"AI開発者キット(中国語)","href":"/developer-kit"},{"label":"AI Developer Kit (EN)","href":"/en/developer-kit"}]},{"header":"ユーザーの声 / Wall of Love","items":[{"label":"ユーザーの声(中国語)","href":"/wall-of-love"},{"label":"Wall of Love(英語)","href":"/en/wall-of-love"}]}]},"navbar":{"links":[{"href":"https://api.apiyi.com","label":"ホーム"},{"href":"https://imagen.apiyi.com","label":"AI画像生成"},{"href":"https://icover.ai","label":"AI動画生成"}],"primary":{"type":"button","label":"コンソール","href":"https://api.apiyi.com/account/profile"}},"href":"ja"},{"language":"ko","banner":{"content":"이 페이지는 AI로 번역되었습니다. 내용이 다를 경우 [English 버전](/en)을 기준으로 하십시오.","dismissible":true},"footer":{"socials":{"website":"https://api.apiyi.com"},"links":[{"header":"AI 통합","items":[{"label":"skill.md","href":"https://docs.apiyi.com/skill.md"},{"label":"llms.txt","href":"https://docs.apiyi.com/llms.txt"},{"label":"llms-full.txt","href":"https://docs.apiyi.com/llms-full.txt"},{"label":"model-registry.json","href":"https://docs.apiyi.com/model-registry.json"},{"label":"AI 개발자 키트(중국어)","href":"/developer-kit"},{"label":"AI Developer Kit (EN)","href":"/en/developer-kit"}]},{"header":"사용자 후기 / Wall of Love","items":[{"label":"사용자 후기(중국어)","href":"/wall-of-love"},{"label":"Wall of Love (영문)","href":"/en/wall-of-love"}]}]},"navbar":{"links":[{"href":"https://api.apiyi.com","label":"홈"},{"href":"https://imagen.apiyi.com","label":"AI 이미지 생성"},{"href":"https://icover.ai","label":"AI 동영상 생성"}],"primary":{"type":"button","label":"콘솔","href":"https://api.apiyi.com/account/profile"}},"href":"ko"},{"language":"ru","banner":{"content":"Эта страница переведена с помощью ИИ. При расхождениях ориентируйтесь на [английскую версию](/en).","dismissible":true},"footer":{"socials":{"website":"https://api.apiyi.com"},"links":[{"header":"AI-интеграция","items":[{"label":"skill.md","href":"https://docs.apiyi.com/skill.md"},{"label":"llms.txt","href":"https://docs.apiyi.com/llms.txt"},{"label":"llms-full.txt","href":"https://docs.apiyi.com/llms-full.txt"},{"label":"model-registry.json","href":"https://docs.apiyi.com/model-registry.json"},{"label":"Набор AI-разработчика (кит.)","href":"/developer-kit"},{"label":"AI Developer Kit (EN)","href":"/en/developer-kit"}]},{"header":"Отзывы пользователей / Wall of Love","items":[{"label":"Отзывы пользователей (на китайском)","href":"/wall-of-love"},{"label":"Wall of Love (EN)","href":"/en/wall-of-love"}]}]},"navbar":{"links":[{"href":"https://api.apiyi.com","label":"Главная"},{"href":"https://imagen.apiyi.com","label":"Генерация изображений"},{"href":"https://icover.ai","label":"Генерация видео"}],"primary":{"type":"button","label":"Консоль","href":"https://api.apiyi.com/account/profile"}},"href":"ru"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"apiyillc","hasAudioNarration":false,"actualSubdomain":"apiyillc","customDomains":["docs.apiyi.com"],"gitSource":{"type":"github","owner":"pdmaker","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"agentFeedback":true},"entitlements":{},"buildId":"6af47fc02a7230ffd7ad03b1","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"zh","tag":"首页","count":214},{"language":"en","tag":"Home","count":214},{"language":"ja","tag":"ホーム","count":214},{"language":"ko","tag":"홈","count":214},{"language":"ru","tag":"Главная","count":214},{"language":"zh-Hant","tag":"首頁","count":214},{"language":"zh","tag":"图片 API(官转)","count":84},{"language":"en","tag":"Image API (Official)","count":84},{"language":"ja","tag":"画像API(公式)","count":84},{"language":"ko","tag":"이미지 API (공식)","count":84},{"language":"ru","tag":"Image API (официальный)","count":84},{"language":"zh-Hant","tag":"圖片 API(官轉)","count":84},{"language":"zh","tag":"公告","count":81},{"language":"en","tag":"Announcements","count":81},{"language":"zh","tag":"AI风向标","count":78},{"language":"en","tag":"AI Radar","count":78},{"language":"zh","tag":"常见问题","count":63},{"language":"en","tag":"FAQ","count":63},{"language":"ja","tag":"FAQ","count":63},{"language":"ko","tag":"FAQ","count":63},{"language":"ru","tag":"FAQ","count":63},{"language":"zh-Hant","tag":"常見問題","count":63},{"language":"zh","tag":"使用场景","count":50},{"language":"en","tag":"Use Cases","count":50},{"language":"ja","tag":"活用例","count":50},{"language":"ko","tag":"활용 사례","count":50},{"language":"ru","tag":"Сценарии использования","count":50},{"language":"zh-Hant","tag":"使用場景","count":50},{"language":"zh","tag":"基础 API","count":47},{"language":"en","tag":"Basic API","count":47},{"language":"ja","tag":"基本API","count":47},{"language":"ko","tag":"기본 API","count":47},{"language":"ru","tag":"Базовый API","count":47},{"language":"zh-Hant","tag":"基礎 API","count":47},{"language":"zh","tag":"模型价格","count":36},{"language":"en","tag":"Model Pricing","count":36},{"language":"ja","tag":"モデル料金","count":36},{"language":"ko","tag":"모델 요금","count":36},{"language":"ru","tag":"Цены на модели","count":36},{"language":"zh-Hant","tag":"模型價格","count":36},{"language":"zh","tag":"视频 API(官转)","count":35},{"language":"en","tag":"Video API (Official)","count":35},{"language":"ja","tag":"動画API(公式)","count":35},{"language":"ko","tag":"동영상 API (공식)","count":35},{"language":"ru","tag":"Video API (официальный)","count":35},{"language":"zh-Hant","tag":"影片 API(官轉)","count":35},{"language":"zh","tag":"文本生成","count":28},{"language":"en","tag":"Text Generation","count":28},{"language":"ja","tag":"テキスト生成","count":28},{"language":"ko","tag":"텍스트 생성","count":28},{"language":"ru","tag":"Генерация текста","count":28},{"language":"zh-Hant","tag":"文本生成","count":28},{"language":"ja","tag":"課金とセキュリティ","count":17},{"language":"ko","tag":"결제 및 보안","count":17},{"language":"ru","tag":"Оплата и безопасность","count":17},{"language":"zh-Hant","tag":"充值與安全","count":17},{"language":"ja","tag":"NanoBananaベストプラクティス","count":15},{"language":"ko","tag":"NanoBanana 모범 사례","count":15},{"language":"ru","tag":"Лучшие практики NanoBanana","count":15},{"language":"zh-Hant","tag":"NanoBanana最佳實踐","count":15}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"models/models.css","content":".mp-layout{display:flex;gap:2.5rem;max-width:1400px;margin:0 auto;padding:2.5rem 1.5rem 4rem;font-size:15px;line-height:1.7;color:rgb(var(--gray-500, 113 115 119))}html.dark .mp-layout{color:rgb(var(--gray-400, 159 161 165))}.mp-rail{display:none}@media (min-width: 1024px){.mp-rail{display:block;width:13rem;flex-shrink:0}}.mp-rail-nav{position:sticky;top:9.25rem;font-size:0.875rem}.mp-rail-head{font-weight:600;margin:0 0 0.375rem;color:rgb(var(--gray-900, 23 25 29))}html.dark .mp-rail-head{color:rgb(var(--gray-200, 223 225 229))}.mp-rail-link{display:block;padding:0.22rem 0;color:rgb(var(--gray-500, 113 115 119));text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mp-rail-link:hover{color:rgb(var(--primary, 37 99 235))}html.dark .mp-rail-link{color:rgb(var(--gray-400, 159 161 165))}html.dark .mp-rail-link:hover{color:rgb(var(--primary-light, 59 130 246))}.mp-rail-vendors{max-height:45vh;overflow-y:auto}.mp-mt{margin-top:1rem}.mp-content{min-width:0;flex:1}.mp-title{font-size:2rem;font-weight:700;letter-spacing:-0.02em;margin:0 0 0.5rem;color:rgb(var(--gray-900, 23 25 29))}html.dark .mp-title{color:#fff}.mp-desc{color:rgb(var(--gray-500, 113 115 119));margin:0 0 1.5rem}html.dark .mp-desc{color:rgb(var(--gray-400, 159 161 165))}.mp-content h2{font-size:1.375rem;font-weight:600;margin:2.75rem 0 1rem;padding-bottom:0.45rem;border-bottom:1px solid rgb(var(--gray-200, 223 225 229) / 0.7);color:rgb(var(--gray-900, 23 25 29));scroll-margin-top:12rem}@media (min-width: 1024px){.mp-content h2{scroll-margin-top:16.5rem}}html.dark .mp-content h2{border-color:rgb(255 255 255 / 0.1);color:#fff}.mp-content p{margin:0.75rem 0}.mp-content ul{margin:0.75rem 0;padding-left:1.4rem}.mp-content li{margin:0.4rem 0}.mp-content strong{color:rgb(var(--gray-900, 23 25 29))}html.dark .mp-content strong{color:#fff}.mp-content a{color:rgb(var(--primary, 37 99 235));text-decoration:none}.mp-content a:hover{text-decoration:underline}html.dark .mp-content a{color:rgb(var(--primary-light, 59 130 246))}.mp-content code{font-size:0.85em;background:rgb(var(--gray-100, 239 241 245) / 0.8);border:1px solid rgb(var(--gray-200, 223 225 229) / 0.7);padding:0.1em 0.35em;border-radius:0.375rem}html.dark .mp-content code{background:rgb(255 255 255 / 0.06);border-color:rgb(255 255 255 / 0.1)}.mp-content code.mp-ep-rec{color:rgb(var(--primary, 37 99 235));background:rgb(var(--primary, 37 99 235) / 0.08);border-color:rgb(var(--primary, 37 99 235) / 0.45);font-weight:600}html.dark .mp-content code.mp-ep-rec{color:rgb(var(--primary-light, 59 130 246));background:rgb(var(--primary-light, 59 130 246) / 0.14);border-color:rgb(var(--primary-light, 59 130 246) / 0.5)}.mp-content table{display:block;max-width:100%;overflow-x:auto;border-collapse:collapse;font-size:0.875rem;margin:1rem 0 1.5rem}.mp-content th{text-align:left;font-weight:500;color:rgb(var(--gray-500, 113 115 119));padding:0.55rem 1.25rem 0.55rem 0;border-bottom:1px solid rgb(var(--gray-200, 223 225 229) / 0.7);white-space:nowrap}.mp-content td{padding:0.55rem 1.25rem 0.55rem 0;border-bottom:1px solid rgb(var(--gray-200, 223 225 229) / 0.45);white-space:nowrap}html.dark .mp-content th{border-color:rgb(255 255 255 / 0.1);color:rgb(var(--gray-400, 159 161 165))}html.dark .mp-content td{border-color:rgb(255 255 255 / 0.07)}.mp-search{display:contents}.mp-search-bar{position:sticky;top:5rem;z-index:20;margin:0 0 1.75rem;background:rgb(var(--background-light, 255 255 255));padding:0.75rem 0 0.85rem;box-shadow:0 10px 14px -10px rgb(var(--gray-950, 11 13 17) / 0.28)}@media (min-width: 1024px){.mp-search-bar{top:9.25rem}}html.dark .mp-search-bar{background:rgb(var(--background-dark, 10 11 16));box-shadow:0 8px 12px -10px rgb(0 0 0 / 0.7)}.mp-search-label{margin:0 0 0.5rem;padding-left:0.6rem;border-left:3px solid rgb(var(--primary, 37 99 235));font-size:0.9rem;font-weight:600;line-height:1.4;color:rgb(var(--primary, 37 99 235))}html.dark .mp-search-label{border-left-color:rgb(var(--primary-light, 59 130 246));color:rgb(var(--primary-light, 59 130 246))}.mp-search-input{width:100%;box-sizing:border-box;border:1px solid rgb(var(--gray-400, 159 161 165) / 0.3);border-radius:0.75rem;padding:0.7rem 1rem 0.7rem 2.65rem;font-size:0.9rem;background-color:rgb(var(--background-light, 255 255 255));background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23717377' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:0.9rem center;color:rgb(var(--gray-900, 23 25 29));outline:none;transition:border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease}.mp-search-input::placeholder{color:rgb(var(--gray-500, 113 115 119))}.mp-search-input:hover{border-color:rgb(var(--gray-600, 81 83 87) / 0.3)}.mp-search-input:focus{border-color:rgb(var(--primary, 37 99 235));box-shadow:0 0 0 3px rgb(var(--primary, 37 99 235) / 0.16)}html.dark .mp-search-input{background-color:rgb(var(--background-dark, 10 11 16));background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239fa1a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E\");border-color:rgb(var(--gray-600, 81 83 87) / 0.3);color:rgb(var(--gray-100, 239 241 245))}html.dark .mp-search-input::placeholder{color:rgb(255 255 255 / 0.5)}html.dark .mp-search-input:hover{border-color:rgb(var(--gray-500, 113 115 119) / 0.35)}html.dark .mp-search-input:focus{border-color:rgb(var(--primary-light, 59 130 246));box-shadow:0 0 0 3px rgb(var(--primary-light, 59 130 246) / 0.22)}.mp-search-meta{font-size:0.75rem;color:rgb(var(--gray-500, 113 115 119));margin:0.75rem 0 0.25rem}.mp-search-empty{font-size:0.875rem;color:rgb(var(--gray-500, 113 115 119));margin-top:0.75rem}html.dark .mp-search-meta,html.dark .mp-search-empty{color:rgb(var(--gray-400, 159 161 165))}.mp-mono{font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;font-size:0.8125rem}@media (min-width: 1024px){.mp-jump{display:none}}"},{"filePath":"styles/agent-prompt.css","content":"div.prompt{border:1.5px solid rgb(var(--primary, 37 99 235) / 0.35);background:rgb(var(--primary, 37 99 235) / 0.035);padding:1.25rem 1.25rem 1rem;row-gap:0.75rem}html.dark div.prompt{border-color:rgb(var(--primary-light, 59 130 246) / 0.4);background:rgb(var(--primary-light, 59 130 246) / 0.06)}div.prompt [data-component-part=\"prompt-content-wrapper\"]{width:100%}div.prompt [data-component-part=\"prompt-actions-wrapper\"]{width:100%;justify-content:flex-end}div.prompt [data-component-part=\"prompt-description\"]{flex:1;font-size:14px;line-height:1.65}div.prompt [data-component-part=\"prompt-description\"]>div>*{margin:0}div.prompt [data-component-part=\"prompt-description\"]>div>*+*{margin-top:0.6rem}div.prompt [data-component-part=\"prompt-description\"] strong{font-size:15px;font-weight:650;color:rgb(var(--gray-900, 23 25 29))}html.dark div.prompt [data-component-part=\"prompt-description\"] strong{color:#fff}div.prompt [data-component-part=\"prompt-description\"]>div>*+p{color:rgb(var(--gray-600, 80 82 86))}html.dark div.prompt [data-component-part=\"prompt-description\"]>div>*+p{color:rgb(var(--gray-400, 159 161 165))}div.prompt [data-component-part=\"prompt-description\"] code{font-size:0.85em;background:rgb(var(--gray-100, 239 241 245) / 0.9);border:1px solid rgb(var(--gray-200, 223 225 229) / 0.7);padding:0.05em 0.35em;border-radius:0.375rem}html.dark div.prompt [data-component-part=\"prompt-description\"] code{background:rgb(255 255 255 / 0.06);border-color:rgb(255 255 255 / 0.1)}div.prompt [data-component-part=\"prompt-description\"] blockquote{margin:0;padding:0.75rem 0.9rem;font-style:normal;border:1px dashed rgb(var(--gray-300, 191 193 197));border-radius:0.6rem;background:rgb(var(--background-light, 255 255 255));font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;font-size:12.5px;line-height:1.6;color:rgb(var(--gray-600, 80 82 86));overflow-wrap:anywhere;-webkit-mask-image:linear-gradient(to bottom, #000 70%, transparent 100%);mask-image:linear-gradient(to bottom, #000 70%, transparent 100%)}div.prompt [data-component-part=\"prompt-description\"] blockquote p,div.prompt [data-component-part=\"prompt-description\"] blockquote ol{margin:0}div.prompt [data-component-part=\"prompt-description\"] blockquote li{padding:0}div.prompt [data-component-part=\"prompt-description\"] blockquote>*+*{margin-top:0.5rem}div.prompt [data-component-part=\"prompt-description\"] blockquote code{background:none;border:0;padding:0;font-size:1em}div.prompt [data-component-part=\"prompt-description\"] blockquote a{color:inherit;text-decoration:none;pointer-events:none}html.dark div.prompt [data-component-part=\"prompt-description\"] blockquote{border-color:rgb(255 255 255 / 0.15);background:rgb(var(--background-dark, 13 13 13));color:rgb(var(--gray-400, 159 161 165))}div.prompt [data-component-part=\"prompt-action-copy-button\"]{padding:0.6rem 1.25rem;font-size:14px;line-height:20px;font-weight:600;border-radius:0.65rem;gap:0.45rem;box-shadow:0 1px 2px rgb(0 0 0 / 0.08), 0 4px 12px rgb(var(--primary, 37 99 235) / 0.25)}div.prompt [data-component-part=\"prompt-action-copy-button\"]::before{content:\"\";width:16px;height:16px;flex-shrink:0;background:currentColor;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E\") center / contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E\") center / contain no-repeat}div.prompt [data-component-part=\"prompt-action-copy-button\"] svg{width:12px;height:12px}@media (max-width: 640px){div.prompt [data-component-part=\"prompt-actions-wrapper\"]>*{flex:1}}"}],"page":{"pagePath":"en/api-capabilities/image-advanced-workflow","slug":"/en/api-capabilities/image-advanced-workflow","pageMetadata":{"title":"Advanced Image Generation: Workflow and Realism","sidebarTitle":"Advanced Workflow","description":"Same model, better output: what consumer image apps add on top of the API — a prompt rewrite layer, reference anchoring, parallel sampling with vision-model selection, and step-by-step retouching. Includes copy-paste realism vocabulary, side-by-side tests, and the cost math.","icon":"workflow","href":"/en/api-capabilities/image-advanced-workflow"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Same model, better output: what consumer image apps add on top of the API — a prompt rewrite layer, reference anchoring, parallel sampling with vision-model selection, and step-by-step retouching. Includes copy-paste realism vocabulary, side-by-side tests, and the cost math.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,AccordionGroup,Card,CardGroup,CodeBlock,Frame,Heading,Info,OptimizedImage,Step,Steps,Table,Tip,Warning}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!AccordionGroup)_missingMdxReference(`AccordionGroup`,true);if(!Card)_missingMdxReference(`Card`,true);if(!CardGroup)_missingMdxReference(`CardGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[_jsx(_components.a,{href:`/en/api-capabilities/image-generation-success-tips`,children:`How to Get the Image You Want`}),` answers “this one attempt failed, how do I rescue it.” This page answers the next question: `,_jsx(_components.strong,{children:`how do I make every attempt land`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`A question that comes up constantly: consumer image products like `,_jsx(_components.code,{children:`freepik.com`}),` and `,_jsx(_components.code,{children:`higgsfield.ai`}),` run on the same base models you do — the same Nano Banana, GPT-Image and FLUX families — yet their output looks more finished. The gap is not in the model weights. `,_jsx(_components.strong,{children:`It is the layer wrapped around the model`}),`, and you can build that layer yourself. This page shows how.`]}),`\n`,_jsx(Heading,{level:`2`,id:`1-what-consumer-image-products-wrap-around-the-model`,children:`1. What consumer image products wrap around the model`}),`\n`,_jsx(_components.p,{children:`Take one of these products apart and you find roughly eight layers outside the model. Every one of them is reproducible on the API:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`What the product does`}),_jsx(_components.th,{children:`Problem it solves`}),_jsx(_components.th,{children:`How to reproduce it on the API`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.strong,{children:`Prompt rewrite layer`}),` (Prompt Enhancer)`]}),_jsx(_components.td,{children:`Users write casually; models want structured description`}),_jsx(_components.td,{children:`Call a text model to rewrite first, then hit the image model (section 2)`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.strong,{children:`Style presets`}),` (dozens of clickable presets, plus saved custom ones)`]}),_jsx(_components.td,{children:`Freezes an aesthetic so users need no photography vocabulary`}),_jsx(_components.td,{children:`A preset is just a prompt-fragment constant in your code plus a fixed set of reference images`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.strong,{children:`Identity anchoring`}),` (e.g. Higgsfield’s `,_jsx(_components.code,{children:`Soul ID`}),`, which trains a persistent identity on 20–80 photos)`]}),_jsx(_components.td,{children:`Same person stays the same across generations`}),_jsx(_components.td,{children:`Approximate it with reference images (see the boundaries below)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Sampling several, showing one`})}),_jsx(_components.td,{children:`The user only ever sees the best candidate, so the perceived hit rate approaches 100%`}),_jsx(_components.td,{children:`Generate N in parallel, then let a vision model score and pick (section 3, steps 3–4)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Step-by-step editing`})}),_jsx(_components.td,{children:`Compound instructions in one shot reliably break down`}),_jsx(_components.td,{children:`Lock composition first, then edit locally, then add text`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.strong,{children:`Upscaling and post-processing`}),` (Freepik acquired Magnific in 2024, offering 2×–16× creative upscaling)`]}),_jsx(_components.td,{children:`Turns small output into print-ready sizes`}),_jsx(_components.td,{children:`APIYI has no such endpoint — generate at the high resolution tier instead (see boundaries below)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Negative prompts and safety fallbacks`})}),_jsx(_components.td,{children:`Steers around known model habits, and catches requests moderation would reject`}),_jsx(_components.td,{children:`Bake fixed negative phrasing into your template, plus a downgrade path for moderation failures`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Asset library and rehosting`})}),_jsx(_components.td,{children:`User images never expire or disappear`}),_jsx(_components.td,{children:`Copy every result into your own object storage immediately`})]})]})]}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Two platform boundaries to settle before you copy a competitor’s feature list:`})}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`APIYI has no upscaling, background-removal, or face-restoration endpoint.`}),` If you need a large image, pick the high resolution tier at generation time (`,_jsx(_components.code,{children:`gpt-image-2`}),` at 4K, Nano Banana Pro at 4K) rather than planning to enlarge afterwards. For a transparent background, use official-relay `,_jsx(_components.code,{children:`gpt-image-2.5-flare`}),` / `,_jsx(_components.code,{children:`gpt-image-2.5-sunburst`}),` with `,_jsx(_components.code,{children:`background: \"transparent\"`}),` — it returns PNG with a real alpha channel (OpenAI shut transparency down for `,_jsx(_components.code,{children:`gpt-image-2`}),` on 2026-09-30) (`,_jsx(_components.code,{children:`seedream-5-0`}),` / `,_jsx(_components.code,{children:`seedream-5-0-pro`}),` can only be prompted, and alpha is not guaranteed on every call). See `,_jsx(_components.a,{href:`/en/faq/image-transparent-background`,children:`How do I generate images with a transparent background`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`APIYI does not offer LoRA or identity training.`}),` The “train once, lock the face forever” capability behind `,_jsx(_components.code,{children:`Soul ID`}),` can only be approximated with reference images: the same character will still drift across scenes and lighting changes, and holds best when the new shot stays close to a frontal view and the original lighting. For commercial characters that demand strict consistency, budget for a human review step.`]}),`\n`]})]}),`\n`,_jsx(Heading,{level:`2`,id:`2-the-first-layer-already-separates-the-results-turn-casual-input-into-structure`,children:`2. The first layer already separates the results: turn casual input into structure`}),`\n`,_jsx(_components.p,{children:`This is the highest-leverage layer, and the one most often skipped.`}),`\n`,_jsx(Heading,{level:`3`,id:`side-by-side-test-one-model-one-brief-two-prompts`,children:`Side-by-side test: one model, one brief, two prompts`}),`\n`,_jsxs(_components.p,{children:[`The brief is “an e-commerce product shot for coffee.” On the left is what a user actually types; on the right is the same brief with the missing decisions filled in. Both ran once on `,_jsx(_components.code,{children:`gemini-3-pro-image`}),` (Nano Banana Pro) at `,_jsx(_components.code,{children:`2K`}),`, `,_jsx(_components.code,{children:`1:1`}),`:`]}),`\n`,_jsx(Frame,{caption:`Casual prompt: 'Make me a coffee product shot, make it look nice, make it feel premium'`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-before.jpg?fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=a2e2025bf74baf40a7b63a424762cb62`,alt:`Coffee image from the casual prompt: wooden table, grinder, burlap sack and other unrequested props, warm nostalgic grading, and an invented brand name printed on the cup`,\"data-og-width\":`1280`,width:`1280`,\"data-og-height\":`1280`,height:`1280`,\"data-path\":`images/image-workflow-prompt-before.jpg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-before.jpg?w=280\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=cdc6f261bdbade3a9151b43d99deed33 280w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-before.jpg?w=560\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=e6f697fd2f035f9d39a0cef120c30ff6 560w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-before.jpg?w=840\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=0ab09776f1d36718beda0903d57cb3e3 840w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-before.jpg?w=1100\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=b23c589ff1264ee042d455f3be56592b 1100w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-before.jpg?w=1650\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=6bf52a162e36e3efc6082e283b140b85 1650w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-before.jpg?w=2500\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=15fdbefaa8ce0c9bf88a8eb0877b09fc 2500w`})}),`\n`,_jsx(Frame,{caption:`Structured prompt: subject, environment, light position, lens, grading, imperfections and composition all specified`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-after.jpg?fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=cb00b095545e5dcad8cb2c113fefe47f`,alt:`Coffee image from the structured prompt: a matte black ceramic cup on a light grey microcement surface, clean blurred background, clear light direction, generous negative space`,\"data-og-width\":`1280`,width:`1280`,\"data-og-height\":`1280`,height:`1280`,\"data-path\":`images/image-workflow-prompt-after.jpg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-after.jpg?w=280\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=1e386f2df340f396a1cb6ab94b10e6f7 280w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-after.jpg?w=560\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=8458932292b8d4ab0a760e6c380a42a5 560w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-after.jpg?w=840\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=72d06312b1f8c31140260787e22ab7c7 840w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-after.jpg?w=1100\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=92afe2e96b655501b908861b2392991a 1100w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-after.jpg?w=1650\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=1df25d991b960115ed294465c1b167eb 1650w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-prompt-after.jpg?w=2500\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=2240107add42d7014c50fc820998f46d 2500w`})}),`\n`,_jsxs(_components.p,{children:[`The left image is not ugly, but it is `,_jsx(_components.strong,{children:`unusable`}),`. The model made a pile of decisions nobody authorized: it added a grinder and a burlap sack, settled on nostalgic warm grading, and printed an invented brand name on the cup — auto-generated text like that makes the frame worthless commercially. The right image can go straight onto a product page: neutral background, a light setup you can describe out loud, and room for copy.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`“Looks nice” and “is usable” are different targets.`}),` A casual prompt can only reach the first one.`]}),`\n`,_jsx(Heading,{level:`3`,id:`the-six-elements-a-rewrite-layer-must-supply`,children:`The six elements a rewrite layer must supply`}),`\n`,_jsx(_components.p,{children:`Rewriting does not mean making the prompt longer. It means filling in missing decisions. An image prompt has six load-bearing parts:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Element`}),_jsx(_components.th,{children:`What happens without it`}),_jsx(_components.th,{children:`Example`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Subject`})}),_jsx(_components.td,{children:`The model improvises and adds props you did not want`}),_jsx(_components.td,{children:`”A matte black ceramic pour-over cup, filled to 80% with black coffee”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Environment`})}),_jsx(_components.td,{children:`Random backgrounds, so a set of images never matches`}),_jsx(_components.td,{children:`”Light grey microcement surface, wall in the same tone, blurred”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Light`})}),_jsx(_components.td,{children:`Flat global illumination that reads as fake instantly`}),_jsx(_components.td,{children:`”Key light from a softbox at upper left, 45 degrees; white bounce card on the right”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Lens and angle`})}),_jsx(_components.td,{children:`Perspective and depth of field are out of your control`}),_jsx(_components.td,{children:`”85mm macro, f/5.6, front view angled 15 degrees down”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Grading and medium`})}),_jsx(_components.td,{children:`Defaults to saturated, rendered-looking output`}),_jsx(_components.td,{children:`”Cool neutral white balance, low overall saturation”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Composition`})}),_jsx(_components.td,{children:`The subject is always dead centre`}),_jsx(_components.td,{children:`”Cup on the left third of the frame, large negative space to the right”`})]})]})]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Resolution is `,_jsx(_components.strong,{children:`not`}),` a seventh element. Output resolution comes only from parameters such as `,_jsx(_components.code,{children:`size`}),` / `,_jsx(_components.code,{children:`imageSize`}),`; writing “4K” or “8K” in the prompt does not add a single pixel. See `,_jsx(_components.a,{href:`/en/api-capabilities/image-compression-resolution`,children:`Image Compression and Output Resolution`}),`.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`the-rewrite-layer-in-code`,children:`The rewrite layer in code`}),`\n`,_jsx(_components.p,{children:`A cheap, fast text model is enough here; its cost is negligible next to generation:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`39`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`39`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.apiyi.com/v1\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"APIYI_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# never hard-code the key`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`REWRITE_SYSTEM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"You are an image prompt engineer. Rewrite the user's casual brief`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`into one structured image prompt.`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Fill in all six elements. Supply whatever is missing; never ask the user:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`1 Subject: material, colour, count, state`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`2 Environment: what the background is, what is sharp and what is blurred`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`3 Light: direction, hardness, fill or no fill — there must be one identifiable key light`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`4 Lens and angle: focal length, aperture, camera height, tilt`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`5 Grading and medium: white balance bias, saturation, film or digital character`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`6 Composition: where the subject sits in the frame, where the negative space is`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Rules:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`- Output only the prompt body: no explanation, no bullet points, no heading`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`- No brand names, logos, or legible text unless the user asked for them`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`- Never use vague quality words such as 8K, ultra HD, masterpiece, perfect`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`- Keep any element the user specified exactly as written\"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` rewrite`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user_prompt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/chat/completions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gemini-3.5-flash\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`REWRITE_SYSTEM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: user_prompt},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` timeout`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`60`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r.raise_for_status()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r.json()[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"choices\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].strip()`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Note the rule banning “8K, ultra HD, masterpiece, perfect” — section 4 explains why.`}),`\n`,_jsx(Heading,{level:`2`,id:`3-a-pipeline-you-can-actually-ship`,children:`3. A pipeline you can actually ship`}),`\n`,_jsx(_components.p,{children:`Chain the remaining four layers onto the rewrite layer and you have the whole thing:`}),`\n`,_jsxs(Steps,{children:[_jsx(Step,{title:`Rewrite: casual input to structured prompt`,children:_jsx(_components.p,{children:`See section 2. This step also neutralizes sensitive content in user input along the way, which measurably reduces how often the request is blocked downstream.`})}),_jsxs(Step,{title:`Anchor: reference images plus a style constant`,children:[_jsxs(_components.p,{children:[`Style is pinned by two things: `,_jsx(_components.strong,{children:`a style constant appended to every prompt`}),` (your preset), and `,_jsx(_components.strong,{children:`a fixed set of reference images`}),`.`]}),_jsx(_components.p,{children:`Reference limits differ sharply by family — confirm yours before you design the pipeline:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Model family`}),_jsx(_components.th,{children:`Reference limit`}),_jsx(_components.th,{children:`Notes`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Nano Banana (all)`}),_jsxs(_components.td,{children:[_jsx(_components.strong,{children:`14`}),` (measured)`]}),_jsxs(_components.td,{children:[`See `,_jsx(_components.a,{href:`/en/api-capabilities/multi-image-fusion-testing`,children:`Multi-Image Fusion Testing`})]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`gpt-image-2`}),` family`]}),_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.strong,{children:`16`})}),_jsxs(_components.td,{children:[`Repeat `,_jsx(_components.code,{children:`image[]`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Seedream`}),_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.strong,{children:`10`})}),_jsx(_components.td,{children:`Inputs plus outputs must stay at or below 15`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`FLUX.2 pro / max / flex`}),_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.strong,{children:`8`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`input_image_2`}),` … `,_jsx(_components.code,{children:`input_image_8`}),`; klein takes 4, Kontext takes 1`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Grok Imagine`}),_jsx(_components.td,{children:_jsx(_components.strong,{children:`1–4`})}),_jsx(_components.td,{children:`A fifth image returns 400`})]})]})]}),_jsxs(_components.p,{children:[`Two rules to respect: `,_jsx(_components.strong,{children:`“image 1 / image 2” in the prompt map strictly to array order`}),`, so state explicitly which is which; and `,_jsxs(_components.strong,{children:[`Grok only honours reference images on `,_jsx(_components.code,{children:`/v1/images/edits`})]}),` — passing them to `,_jsx(_components.code,{children:`/v1/images/generations`}),` silently discards them and still bills you.`]})]}),_jsxs(Step,{title:`Sample: generate N in parallel, do not rely on n`,children:[_jsx(_components.p,{children:`The “it nailed it first try” feel of a consumer product is really the product drawing several cards on your behalf.`}),_jsxs(_components.p,{children:[`But `,_jsxs(_components.strong,{children:[`the server-side `,_jsx(_components.code,{children:`n`}),` parameter has no effect on most image models`]}),` (Seedream ignores it outright). To get multiple candidates, fire multiple requests concurrently from the client — the skill pages on this site cap it at 5 at a time. Tune concurrency per channel; some start returning 429 at 2, so add exponential backoff.`]})]}),_jsxs(Step,{title:`Select: use a vision model as the judge`,children:[_jsx(_components.p,{children:`Once you have N candidates you must pick automatically, otherwise you have simply pushed the choice onto the user.`}),_jsxs(_components.p,{children:[`Send the candidates back to a vision model for scoring over the standard `,_jsx(_components.code,{children:`/v1/chat/completions`}),` image input; see `,_jsx(_components.a,{href:`/en/api-capabilities/vision-understanding`,children:`Vision Understanding`}),` for eligible models. Fix the rubric at five dimensions and demand JSON back: instruction compliance, structure and anatomy, text correctness, texture realism, composition.`]}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`Do not use `,_jsx(_components.code,{children:`/v1/rerank`}),` for this. `,_jsx(_components.code,{children:`bge-reranker-v2-m3`}),` is a `,_jsx(_components.strong,{children:`text-only`}),` reranking model and does not accept images. Scoring images requires a vision understanding model.`]})})]}),_jsxs(Step,{title:`Retouch and land it`,children:[_jsx(_components.p,{children:`Adjust locally after the composition is settled — far higher success rate than one compound instruction:`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Pixel-level local repaint`}),`: only the `,_jsxs(_components.strong,{children:[`official-relay `,_jsx(_components.code,{children:`gpt-image-2`})]}),` supports masks; see `,_jsx(_components.a,{href:`/en/api-capabilities/gpt-image-2/mask-editing`,children:`Mask Inpainting Guide`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Multi-turn cumulative editing`}),`: supported on the `,_jsx(_components.strong,{children:`native Gemini endpoint`}),` for Nano Banana models (feed the previous image back as `,_jsx(_components.code,{children:`role: \"model\"`}),`); the reverse-engineered routes do not support it.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Rehost immediately`}),`: every returned URL is temporary (FLUX about 10 minutes and without CORS; Seedream and R2 about 24 hours), so download into your own object storage as soon as you have it.`]}),`\n`]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`minimal-end-to-end-implementation`,children:`Minimal end-to-end implementation`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`83`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`83`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` base64`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` concurrent.futures `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ThreadPoolExecutor`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.apiyi.com\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"APIYI_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`HEAD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`STYLE_CONST`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Cool neutral white balance, low saturation, clean frame with generous negative space.\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` draw`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`prompt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`size`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"2K\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`aspect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"1:1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Generate one image (Nano Banana Pro, native Gemini endpoint).\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1beta/models/gemini-3-pro-image:generateContent\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` body `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"contents\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"parts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: prompt}]}],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"generationConfig\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"responseModalities\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"IMAGE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"imageConfig\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"aspectRatio\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: aspect, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"imageSize\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: size},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(url, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`HEAD`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`body, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`timeout`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`600`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# headroom for 4K`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r.raise_for_status()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` parts `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r.json()[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"candidates\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"parts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` part `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` next`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((p `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` parts `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"inlineData\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)), `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` part `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`is`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# HTTP 200 with no image usually means moderation`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` raise`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` RuntimeError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"no image returned: \"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json.dumps(parts)[:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`300`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` base64.b64decode(part[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"inlineData\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` score`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`image`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`prompt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`dict`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Score a candidate with a vision model; returns per-dimension scores and one issue line.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data_url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"data:image/png;base64,\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` base64.b64encode(image).decode()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rubric `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Score this image and return strict JSON: \"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{\"instruction\":0-10,\"anatomy\":0-10,\"text\":0-10,\"texture\":0-10,'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '\"composition\":0-10,\"total\":0-50,\"issue\":\"one sentence\"}. '`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"instruction = does it satisfy the brief below; anatomy = errors in hands, limbs, object structure; \"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"text = is any text in the image correct (score 10 if there is none); \"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"texture = does it read as a real photograph rather than a render; \"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"composition = is the framing usable. The brief:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` prompt`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`BASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/chat/completions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`HEAD`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gemini-3.5-flash\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: rubric},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"image_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"image_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: data_url}},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]}],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"response_format\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"json_object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` timeout`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`120`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r.raise_for_status()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json.loads(r.json()[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"choices\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` best_of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user_input`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` prompt `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rewrite(user_input) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` STYLE_CONST`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # steps 1 and 2`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` with`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ThreadPoolExecutor(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`max_workers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pool: `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# step 3: client-side fan-out`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` results `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` list`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(pool.map(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`lambda`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` _`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: _safe(draw, prompt), `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`range`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(n)))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cands `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [img `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ok, img `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` results `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ok]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cands:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` raise`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` RuntimeError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"all candidates failed; check moderation or fall back to another model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` with`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ThreadPoolExecutor(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`max_workers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`len`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(cands)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pool: `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# step 4: score in parallel`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` scores `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` list`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(pool.map(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`lambda`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` im`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: score(im, prompt), cands))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ranked `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` sorted`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`zip`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(cands, scores), `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`lambda`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` x`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: x[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"total\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`reverse`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ranked[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# step 5 retouch/rehost hooks in here`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` _safe`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`fn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`args`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, fn(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`args)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` except`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` Exception`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` e: `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# one failure must not sink the batch`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` False`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(e)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`4-removing-the-ai-look`,children:`4. Removing the AI look`}),`\n`,_jsxs(_components.p,{children:[`“AI look” is not a mystery. It is `,_jsx(_components.strong,{children:`a set of concrete traits you can remove one at a time`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`side-by-side-test`,children:`Side-by-side test`}),`\n`,_jsxs(_components.p,{children:[`Same model (`,_jsx(_components.code,{children:`gemini-3-pro-image`}),`), same subject, two prompt styles, two images each, first one shown from each batch:`]}),`\n`,_jsx(Frame,{caption:`Bare prompt: 'A photorealistic half-body portrait of a young woman by a cafe window, smiling at the camera, 8K, ultra HD, ultra detailed, flawless skin, beautiful, perfect lighting, masterpiece'`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-before.jpg?fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=0623ee0bf7aa07fab43cd347d9aa4a7d`,alt:`Portrait from the bare prompt: subject centred and facing the camera, even illumination with no discernible light direction, tidy background, the look of generic stock photography`,\"data-og-width\":`1280`,width:`1280`,\"data-og-height\":`956`,height:`956`,\"data-path\":`images/image-workflow-texture-before.jpg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-before.jpg?w=280\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=1da07d9d22728413529c5cd02ca7a8a4 280w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-before.jpg?w=560\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=48cc76890fc115ba84418cc29080dc48 560w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-before.jpg?w=840\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=0596f0e5a57cf031c576b1f3fc2f457c 840w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-before.jpg?w=1100\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=0a949b43b54a71d68b17662bcaefd01a 1100w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-before.jpg?w=1650\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=6cd2bb12f2dcf609d2d8c5abb0bd0156 1650w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-before.jpg?w=2500\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=402aea8964783728164b064d5d65b673 2500w`})}),`\n`,_jsx(Frame,{caption:`The same subject after adding four blocks of control language: light position, lens, medium, imperfections`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-after.jpg?fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=83efd55ea2ba552a67c04aa2e0f99936`,alt:`Portrait from the controlled prompt: single directional window light, half the face in shadow, visible pores and facial fuzz, a small mole on the cheek, loose strands of hair, film grading, subject placed right of centre`,\"data-og-width\":`1280`,width:`1280`,\"data-og-height\":`956`,height:`956`,\"data-path\":`images/image-workflow-texture-after.jpg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-after.jpg?w=280\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=bccba09fbb4d009c48de6e45cd3e81f9 280w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-after.jpg?w=560\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=c40cc2e21dab1a17da9bd9d3790c8f9e 560w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-after.jpg?w=840\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=700e5a4768bb1be633dbae7bd4d16919 840w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-after.jpg?w=1100\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=6c083ef18a027864f0197bdc55b5745d 1100w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-after.jpg?w=1650\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=3ce88999d2c9543ea9f3f9463a955fb7 1650w, https://mintcdn.com/apiyillc/4sMX_MxhL2nRcbPH/images/image-workflow-texture-after.jpg?w=2500\u0026fit=max\u0026auto=format\u0026n=4sMX_MxhL2nRcbPH\u0026q=85\u0026s=89f7d08d6891faecd09c16be56c62999 2500w`})}),`\n`,_jsxs(_components.p,{children:[`The left image is not bad — the base model is strong enough that a bare prompt still yields a good-looking picture. But it carries the full trait set: `,_jsx(_components.strong,{children:`the subject is locked dead centre, the light is so even you cannot say where it comes from, and every element is agreeable`}),`. And it is not a fluke: both images from that batch shared essentially the same framing and lighting pattern.`]}),`\n`,_jsxs(_components.p,{children:[`The right image switched approach: the light has a direction, half the face is allowed to fall into shadow, skin shows oil and pores, there is a mole on the cheek, stray hairs are unbrushed, and the subject sits right of centre. It reads as `,_jsx(_components.strong,{children:`a specific person photographed at a specific moment`}),`, rather than “stock image of woman smiling in cafe.”`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`This is also where the real value of a pipeline shows. It does not turn ugly output into pretty output — it `,_jsx(_components.strong,{children:`turns “lucky good” into “the good you specified, can describe, and can reproduce.”`}),` A stakeholder might not prefer the right image, but with the left one you cannot say why it looks the way it does, and you cannot ask the next image to match it.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`symptom-fix-and-what-not-to-write`,children:`Symptom, fix, and what not to write`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Symptom of the AI look`}),_jsx(_components.th,{children:`Fix (write this into the prompt)`}),_jsx(_components.th,{children:`Do not write this`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Subject always centred, symmetric framing`}),_jsx(_components.td,{children:`Specify placement: “subject right of centre, negative space at left\"`}),_jsx(_components.td,{children:`\"perfect composition”, “golden ratio”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Plastic skin with no pores`}),_jsx(_components.td,{children:`”natural skin texture, visible pores and facial fuzz, slight shine on the nose, no retouching\"`}),_jsx(_components.td,{children:`\"flawless skin”, “exquisite”, “beautiful”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Even light with no identifiable source`}),_jsx(_components.td,{children:`Name one key light and its hardness: “window light from the left is the only source, right half of the face in shadow\"`}),_jsx(_components.td,{children:`\"perfect lighting”, “soft lighting”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Fake depth of field, background looks pasted on`}),_jsx(_components.td,{children:`Give focal length and aperture: “85mm, f/2.8, focus on the near eye\"`}),_jsx(_components.td,{children:`\"blurred background”, “cinematic”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Oversaturated, glowing colour`}),_jsx(_components.td,{children:`Give medium and white balance: “Kodak Portra 400 character, warm highlights and cool shadows, low saturation\"`}),_jsx(_components.td,{children:`\"vivid colours”, “HDR”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Everything brand new and unworn`}),_jsx(_components.td,{children:`Add wear deliberately: “pilled sweater, water rings and crumbs on the table\"`}),_jsx(_components.td,{children:`\"clean and tidy”, “premium texture”`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Reads like a poster or a render`}),_jsx(_components.td,{children:`Specify the shooting situation: “candid”, “eye level from the next table\"`}),_jsx(_components.td,{children:`\"8K”, “ultra HD”, “masterpiece”`})]})]})]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[`Vague quality words such as `,_jsx(_components.code,{children:`8K`}),`, `,_jsx(_components.code,{children:`ultra HD`}),`, `,_jsx(_components.code,{children:`ultra detailed`}),`, `,_jsx(_components.code,{children:`masterpiece`}),` and `,_jsx(_components.code,{children:`perfect`}),` are a net negative.`]}),` They add no resolution (only parameters do that) and they push the model toward an over-sharpened, oversaturated render — precisely the core of the AI look. The left-hand prompt above was stuffed with them, and the result shows it. If you want quality, write specific light, lens and medium instead.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`four-blocks-of-copy-paste-control-language`,children:`Four blocks of copy-paste control language`}),`\n`,_jsx(_components.p,{children:`Mix into the prompt as needed; one or two lines from each block is usually enough:`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`Light`,icon:`sun`,children:_jsx(_components.p,{children:`window light from the left is the only source in frame / hard back-side light at three in the afternoon / backlit, with a rim light on the hair / a desk lamp as a practical light inside the frame / overcast diffuse light with no distinct shadows`})}),_jsx(Card,{title:`Lens`,icon:`aperture`,children:_jsx(_components.p,{children:`35mm f/2.0, candid, at eye level / 85mm f/2.8, focus on the near eye / 24mm from a low camera position, slight edge distortion / long lens compressing the space, flattened background layers / mild vignetting in the corners`})}),_jsx(Card,{title:`Medium`,icon:`film`,children:_jsx(_components.p,{children:`Kodak Portra 400 character, fine grain / warm highlights, cool shadows / Polaroid instant film, low contrast, soft edges / noise and colour cast of an early CCD digital camera / low saturation overall, no sharpening`})}),_jsx(Card,{title:`Imperfections`,icon:`scan-line`,children:_jsx(_components.p,{children:`natural skin texture, visible pores and facial fuzz / a few loose strands of hair, unbrushed / pilled sweater, worn cuffs / water rings, fingerprints and crumbs on the table / off-centre framing, part of the subject cropped at the edge`})})]}),`\n`,_jsx(Heading,{level:`3`,id:`three-complete-examples`,children:`Three complete examples`}),`\n`,_jsxs(AccordionGroup,{children:[_jsx(Accordion,{title:`Portrait: candid, not an ID photo`,id:`portrait-candid-not-an-id-photo`,children:_jsx(_components.p,{children:`Candid half-body portrait: a woman in her mid-twenties by a cafe window, turned to the side, looking out, a smile she is not quite holding back. Window light from the left is the only source in the frame; the right half of her face falls into shadow, with a small hard-edged shadow under the bridge of her nose. 85mm lens, f/2.8, eye level, focus on the near eye. Kodak Portra 400 character with fine visible grain, warm highlights and cool shadows, low saturation overall. Natural skin: visible pores and facial fuzz, a little shine on the side of the nose, a small mole on the left cheek, a few stray eyebrow hairs, loose strands of hair unbrushed at the forehead. No skin smoothing, no beauty retouching, no sharpening. Subject right of centre, negative space at left.`})}),_jsx(Accordion,{title:`Product shot: ready for a product page`,id:`product-shot-ready-for-a-product-page`,children:_jsx(_components.p,{children:`E-commerce hero shot: a matte black ceramic pour-over cup filled to 80% with black coffee, a fine ring of crema on the surface. It sits on a light grey microcement surface, with a wall in the same tone blurred behind it. Key light from a softbox at upper left, 45 degrees; a white bounce card at the right leaves a narrow highlight along the right edge of the cup; a soft cast shadow falls to the rear right. 85mm macro lens, f/5.6, front view angled 15 degrees down, the whole cup sharp. Cool neutral white balance, low saturation overall. The glaze has slight handmade unevenness and one tiny kiln mark, and the rim shows a very faint trace of use. Generous negative space, cup on the left third of the frame. No brand names or text anywhere in the image.`})}),_jsx(Accordion,{title:`Environment: give it a specific time and weather`,id:`environment-give-it-a-specific-time-and-weather`,children:_jsx(_components.p,{children:`A narrow old-town street at six in the evening, just after rain, puddles reflecting the light boxes of the shops on both sides. The only key light is a warm street lamp at the end of the street, with shop windows as fill, and a trace of cold dusk still in the sky, setting up a warm-cool contrast. 28mm lens, f/4, camera at eye level, tilted slightly up. Low saturation overall, noise retained in the shadows, no shadow lifting. The walls carry water stains, torn old posters and air-conditioning units; power lines cross the upper part of the frame. Nobody faces the camera; the passers-by are seen from behind and slightly motion blurred.`})})]}),`\n`,_jsx(Heading,{level:`2`,id:`5-facts-that-will-reshape-your-pipeline-design`,children:`5. Facts that will reshape your pipeline design`}),`\n`,_jsx(_components.p,{children:`Knowing these up front saves a round of rework:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Fact`}),_jsx(_components.th,{children:`Consequence for the pipeline`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.strong,{children:`Seed is effectively unavailable across this product line`}),`: no Nano Banana or GPT-Image model exposes a seed, Seedream 4.x / 5.x seeds have been measured as ineffective, and Grok Imagine does not support one`]}),_jsxs(_components.td,{children:[`Do not build reproducibility on seeds. `,_jsx(_components.strong,{children:`The only reliable reproduction is archiving the full successful request`}),` — prompt, reference images, every parameter — and replaying it verbatim`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsxs(_components.strong,{children:[`The server-side `,_jsx(_components.code,{children:`n`}),` parameter has no effect on most image models`]})}),_jsx(_components.td,{children:`Multiple candidates must come from client-side concurrency; load-test the concurrency per channel and add exponential backoff`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`All image APIs are synchronous, have no task ID, and still bill on disconnect`})}),_jsxs(_components.td,{children:[`The pipeline needs its own task queue; see `,_jsx(_components.a,{href:`/en/api-capabilities/image-async-queue`,children:`Build Your Own Async Queue`}),` and `,_jsx(_components.a,{href:`/en/api-capabilities/image-api-best-practices`,children:`Image API Essentials`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`No upscaling, background-removal, or face-restoration endpoint`})}),_jsxs(_components.td,{children:[`Settle the output size at generation time; for a transparent background pass `,_jsx(_components.code,{children:`background: \"transparent\"`}),` to `,_jsx(_components.code,{children:`gpt-image-2.5-flare`}),` / `,_jsx(_components.code,{children:`gpt-image-2.5-sunburst`}),` (not a cutout endpoint — it generates on transparency directly)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`HTTP 200 with no image usually means a moderation block`})}),_jsxs(_components.td,{children:[`Selection logic must distinguish “no image came back” from “an image came back and it is bad”; for the former see `,_jsx(_components.a,{href:`/en/api-capabilities/gemini-image-error-handling`,children:`Gemini Image Error Handling`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Every returned image URL is a temporary link`})}),_jsx(_components.td,{children:`Rehost the moment you receive it; never store the upstream URL in your database`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.strong,{children:`GPT-Image prompts are capped at 8,192 tokens`}),` (measured; no error when exceeded, the whole prompt is silently ignored; about 11,000 Chinese characters)`]}),_jsxs(_components.td,{children:[`Do not paste brand books or packaging specs straight into the image model; distill them with a text model into a 1K to 3K character structured prompt first, see `,_jsx(_components.a,{href:`/en/api-capabilities/image-long-prompt`,children:`Long Prompts`})]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`6-cost-math-when-the-pipeline-is-worth-it`,children:`6. Cost math: when the pipeline is worth it`}),`\n`,_jsxs(_components.p,{children:[`A pipeline trades money for success rate. Output dominates image cost (`,_jsx(_components.code,{children:`gpt-image-2`}),` bills output at $30 per million tokens), while the text and vision models used for rewriting and scoring are close to noise. So cost is essentially “how many candidates did you generate.”`]}),`\n`,_jsx(_components.p,{children:`Use three tiers rather than one setting for everything:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Tier`}),_jsx(_components.th,{children:`Composition`}),_jsx(_components.th,{children:`Relative cost`}),_jsx(_components.th,{children:`Use for`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Draft`})}),_jsx(_components.td,{children:`Single shot from a Lite model`}),_jsx(_components.td,{children:`1×`}),_jsx(_components.td,{children:`Internal previews, bulk placeholders, casual user experiments`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Standard`})}),_jsx(_components.td,{children:`Rewrite + 2 candidates + scored pick`}),_jsx(_components.td,{children:`about 2×`}),_jsx(_components.td,{children:`The default path in a consumer product`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Premium`})}),_jsx(_components.td,{children:`Rewrite + 4 candidates + scoring + one local retouch`}),_jsx(_components.td,{children:`about 5×`}),_jsx(_components.td,{children:`Product hero images, ad creative, anything delivered externally`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`The test is simple: `,_jsx(_components.strong,{children:`will anyone outside your team see this image?`}),` If yes, Standard or above pays for itself; if it is an internal glance, Draft is enough. You can also add a gate in between — only generate more candidates when the top score falls below a threshold, which lets most requests converge at two.`]}),`\n`,_jsx(Heading,{level:`2`,id:`quick-summary`,children:`Quick summary`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`The gap is not in the model weights, it is in `,_jsx(_components.strong,{children:`the eight layers around the model`}),`: rewrite, presets, anchoring, sampling, selection, step-by-step editing, post-processing, rehosting.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`The rewrite layer has the best return`}),`: fill in subject, environment, light, lens, grading and composition, and “looks nice” becomes “is usable.”`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Multiple candidates plus vision-model scoring`}),` is where the high perceived success rate of consumer products actually comes from. `,_jsx(_components.code,{children:`n`}),` does not work, so fan out client-side; `,_jsx(_components.code,{children:`/v1/rerank`}),` cannot score images.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Removing the AI look means adding specifics, not adjectives`}),`: name one light source, give focal length and aperture, specify medium and grain, add imperfections on purpose, and move the subject off centre.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`8K`}),` / `,_jsx(_components.code,{children:`masterpiece`}),` / `,_jsx(_components.code,{children:`perfect lighting`}),` are net negatives`]}),` — no extra resolution, and they push the frame toward a rendered look.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Do not count on seeds for reproduction`}),`; archive the full request instead. Image APIs are synchronous and bill on disconnect, so the pipeline needs a queue.`]}),`\n`,_jsx(_components.li,{children:`APIYI has no upscaling, background-removal, or identity-training endpoints; design around those layers from the start.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`related-documentation`,children:`Related documentation`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`How to Get the Image You Want`,icon:`target`,href:`/en/api-capabilities/image-generation-success-tips`,children:_jsx(_components.p,{children:`Rescuing a single failed call: rewrite the prompt, retry, switch models, isolate with a test tool`})}),_jsx(Card,{title:`Image API Essentials`,icon:`book-check`,href:`/en/api-capabilities/image-api-best-practices`,children:_jsx(_components.p,{children:`Synchronous calls, timeout tiers, billing, base64 handling, input image preprocessing`})}),_jsx(Card,{title:`Mask Inpainting Guide`,icon:`scissors`,href:`/en/api-capabilities/gpt-image-2/mask-editing`,children:_jsx(_components.p,{children:`Pixel-level local edits, exclusive to the official-relay gpt-image-2`})}),_jsx(Card,{title:`Multi-Image Fusion Testing`,icon:`images`,href:`/en/api-capabilities/multi-image-fusion-testing`,children:_jsx(_components.p,{children:`How reference limits were measured, plus a 14-image fusion result`})}),_jsx(Card,{title:`Vision Understanding`,icon:`eye`,href:`/en/api-capabilities/vision-understanding`,children:_jsx(_components.p,{children:`Vision models you can use to score candidate images, and how to call them`})}),_jsx(Card,{title:`Build Your Own Async Queue`,icon:`list-checks`,href:`/en/api-capabilities/image-async-queue`,children:_jsx(_components.p,{children:`Wrapping synchronous generation in a task queue to support a multi-candidate pipeline`})})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Advanced Image Generation: Workflow and Realism","sidebarTitle":"Advanced Workflow","description":"Same model, better output: what consumer image apps add on top of the API — a prompt rewrite layer, reference anchoring, parallel sampling with vision-model selection, and step-by-step retouching. Includes copy-paste realism vocabulary, side-by-side tests, and the cost math.","icon":"workflow","href":"/en/api-capabilities/image-advanced-workflow"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"1. What consumer image products wrap around the model","slug":"1-what-consumer-image-products-wrap-around-the-model","depth":2,"children":[]},{"title":"2. The first layer already separates the results: turn casual input into structure","slug":"2-the-first-layer-already-separates-the-results-turn-casual-input-into-structure","depth":2,"children":[{"title":"Side-by-side test: one model, one brief, two prompts","slug":"side-by-side-test-one-model-one-brief-two-prompts","depth":3,"children":[]},{"title":"The six elements a rewrite layer must supply","slug":"the-six-elements-a-rewrite-layer-must-supply","depth":3,"children":[]},{"title":"The rewrite layer in code","slug":"the-rewrite-layer-in-code","depth":3,"children":[]}]},{"title":"3. A pipeline you can actually ship","slug":"3-a-pipeline-you-can-actually-ship","depth":2,"children":[{"title":"Minimal end-to-end implementation","slug":"minimal-end-to-end-implementation","depth":3,"children":[]}]},{"title":"4. Removing the AI look","slug":"4-removing-the-ai-look","depth":2,"children":[{"title":"Side-by-side test","slug":"side-by-side-test","depth":3,"children":[]},{"title":"Symptom, fix, and what not to write","slug":"symptom-fix-and-what-not-to-write","depth":3,"children":[]},{"title":"Four blocks of copy-paste control language","slug":"four-blocks-of-copy-paste-control-language","depth":3,"children":[]},{"title":"Three complete examples","slug":"three-complete-examples","depth":3,"children":[]}]},{"title":"5. Facts that will reshape your pipeline design","slug":"5-facts-that-will-reshape-your-pipeline-design","depth":2,"children":[]},{"title":"6. Cost math: when the pipeline is worth it","slug":"6-cost-math-when-the-pipeline-is-worth-it","depth":2,"children":[]},{"title":"Quick summary","slug":"quick-summary","depth":2,"children":[]},{"title":"Related documentation","slug":"related-documentation","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"apiyillc","siteName":"API易文档中心","title":"Advanced Image Generation: Workflow and Realism - API易文档中心","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"zh":{"href":"/api-capabilities/image-advanced-workflow","matchLevel":1},"en":{"href":"/en/api-capabilities/image-advanced-workflow","matchLevel":0},"zh-Hant":{"href":"/zh-Hant/api-capabilities/image-advanced-workflow","matchLevel":1},"ja":{"href":"/ja/api-capabilities/image-advanced-workflow","matchLevel":1},"ko":{"href":"/ko/api-capabilities/image-advanced-workflow","matchLevel":1},"ru":{"href":"/ru/api-capabilities/image-advanced-workflow","matchLevel":1}}},"lastModified":"2026-10-20T16:50:03.190Z","originalFileLocation":"en/api-capabilities/image-advanced-workflow.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Same model, better output: what consumer image apps add on top of the API — a prompt rewrite layer, reference anchoring, parallel sampling with vision-model selection, and step-by-step retouching. Includes copy-paste realism vocabulary, side-by-side tests, and the cost math.\">\u003cmeta data-mint-head name=\"application-name\" content=\"API易文档中心\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Advanced Image Generation: Workflow and Realism - API易文档中心\">\u003cmeta data-mint-head property=\"og:description\" content=\"Same model, better output: what consumer image apps add on top of the API — a prompt rewrite layer, reference anchoring, parallel sampling with vision-model selection, and step-by-step retouching. Includes copy-paste realism vocabulary, side-by-side tests, and the cost math.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"API易文档中心\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://apiyillc.mintlify.site/_mintlify/api/og/v2?division=Image+API+Essentials\u0026amp;title=Advanced+Image+Generation%3A+Workflow+and+Realism\u0026amp;description=Same+model%2C+better+output%3A+what+consumer+image+apps+add+on+top+of+the+API+%E2%80%94+a+prompt+rewrite+layer%2C+reference+anchoring%2C+parallel+sampling+with+vision-model+sel\u0026amp;theme=84509e4a5d1cb12fd162de92\u0026amp;signature=1d322181fd431b9d270cd385dda95f03557e82ddb38271e2f9f523b8fc4e383b\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Advanced Image Generation: Workflow and Realism - API易文档中心\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Same model, better output: what consumer image apps add on top of the API — a prompt rewrite layer, reference anchoring, parallel sampling with vision-model selection, and step-by-step retouching. Includes copy-paste realism vocabulary, side-by-side tests, and the cost math.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://apiyillc.mintlify.site/_mintlify/api/og/v2?division=Image+API+Essentials\u0026amp;title=Advanced+Image+Generation%3A+Workflow+and+Realism\u0026amp;description=Same+model%2C+better+output%3A+what+consumer+image+apps+add+on+top+of+the+API+%E2%80%94+a+prompt+rewrite+layer%2C+reference+anchoring%2C+parallel+sampling+with+vision-model+sel\u0026amp;theme=84509e4a5d1cb12fd162de92\u0026amp;signature=1d322181fd431b9d270cd385dda95f03557e82ddb38271e2f9f523b8fc4e383b\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/apiyillc/sQlsuRwD6o27XLvg/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"API易文档中心\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2563eb\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/en/api-capabilities/image-advanced-workflow.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh\" href=\"https://docs.apiyi.com/api-capabilities/image-advanced-workflow\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh-Hant\" href=\"https://docs.apiyi.com/zh-Hant/api-capabilities/image-advanced-workflow\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ja\" href=\"https://docs.apiyi.com/ja/api-capabilities/image-advanced-workflow\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ko\" href=\"https://docs.apiyi.com/ko/api-capabilities/image-advanced-workflow\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ru\" href=\"https://docs.apiyi.com/ru/api-capabilities/image-advanced-workflow\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.apiyi.com/api-capabilities/image-advanced-workflow\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.apiyi.com/#organization\",\"name\":\"API易文档中心\",\"url\":\"https://docs.apiyi.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/apiyillc/LjCT1O0GrSur6F2v/logo/light.svg?fit=max\u0026auto=format\u0026n=LjCT1O0GrSur6F2v\u0026q=85\u0026s=4119ef17a74cc54be127f34578d8b5fa\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.apiyi.com#website\",\"name\":\"API易文档中心\",\"url\":\"https://docs.apiyi.com\",\"publisher\":{\"@id\":\"https://docs.apiyi.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow#webpage\",\"url\":\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow\",\"name\":\"Advanced Image Generation: Workflow and Realism\",\"description\":\"Same model, better output: what consumer image apps add on top of the API — a prompt rewrite layer, reference anchoring, parallel sampling with vision-model selection, and step-by-step retouching. Includes copy-paste realism vocabulary, side-by-side tests, and the cost math.\",\"dateModified\":\"2026-10-20T16:50:03.190Z\",\"isPartOf\":{\"@id\":\"https://docs.apiyi.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Image API (Official)\",\"item\":\"https://docs.apiyi.com/en/api-capabilities/image-api-best-practices\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Image API Essentials\",\"item\":\"https://docs.apiyi.com/en/api-capabilities/image-api-best-practices\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Advanced Image Generation: Workflow and Realism\",\"item\":\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow#article\",\"headline\":\"Advanced Image Generation: Workflow and Realism\",\"name\":\"Advanced Image Generation: Workflow and Realism\",\"description\":\"Same model, better output: what consumer image apps add on top of the API — a prompt rewrite layer, reference anchoring, parallel sampling with vision-model selection, and step-by-step retouching. Includes copy-paste realism vocabulary, side-by-side tests, and the cost math.\",\"url\":\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow\",\"mainEntityOfPage\":{\"@id\":\"https://docs.apiyi.com/en/api-capabilities/image-advanced-workflow#webpage\"},\"dateModified\":\"2026-10-20T16:50:03.190Z\",\"publisher\":{\"@id\":\"https://docs.apiyi.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.apiyi.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"API易文档中心\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"API易文档中心\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/en/api-capabilities/image-advanced-workflow.md","siteName":"API易文档中心","nav":{"global":{"anchors":[]},"languages":[{"language":"zh","pages":[{"title":"zh","href":"/api-capabilities/image-advanced-workflow"}]},{"language":"en","navbar":{"links":[{"href":"https://api.apiyi.com","label":"Home"},{"href":"https://imagen.apiyi.com","label":"AI Image"},{"href":"https://icover.ai","label":"AI Video"}],"primary":{"type":"button","label":"Console","href":"https://api.apiyi.com/account/profile"}},"tabs":[{"tab":"Home","icon":"house","groups":[{"group":"Basics","pages":[{"title":"APIYI - AI Model API Hub","sidebarTitle":"Introduction","icon":"house","href":"/en"},{"title":"Quick Start","icon":"rocket","href":"/en/getting-started"},{"group":"AI Developer Kit","icon":"terminal","pages":[{"title":"AI Developer Kit","sidebarTitle":"AI Developer Kit","icon":"bot","href":"/en/developer-kit"},{"title":"Why Does My Terminal Say apiyi Command Not Found?","icon":"terminal","href":"/en/faq/apiyi-cli-command-not-found"}]},{"group":"API Manual","icon":"book","pages":[{"title":"API Manual","sidebarTitle":"Manual Overview","icon":"book","href":"/en/api-manual"},{"title":"Capturing API Error Details","sidebarTitle":"Error Capture","icon":"clipboard-list","href":"/en/api-manual/error-reporting"},{"group":"Integration FAQ","icon":"circle-question-mark","expanded":false,"pages":[{"title":"Does APIYI Support the Files API?","icon":"file-up","href":"/en/faq/files-api-not-supported"},{"title":"How to Configure Base URL? Differences Between /v1, Root Domain, and /v1beta","icon":"link","href":"/en/faq/base-url-config"},{"title":"How Can I Troubleshoot Model API Errors?","icon":"alert-triangle","href":"/en/faq/model-error-troubleshooting"},{"title":"What Are the API Concurrency Limits?","icon":"gauge","href":"/en/faq/api-concurrency"}]}]},{"title":"Pricing","icon":"badge-dollar-sign","href":"/en/pricing"}]},{"group":"Basic API","icon":"box","pages":[{"group":"Popular Models","icon":"cpu","root":{"title":"Popular Model Recommendations - APIYI, Always Up to Date","sidebarTitle":"Popular Models","icon":"database","href":"/en/api-capabilities/model-info"},"pages":[{"group":"Model FAQ","icon":"circle-question-mark","expanded":false,"pages":[{"title":"How to Choose the Right AI Model?","icon":"compass","href":"/en/faq/model-selection-guide"},{"title":"Why do official web apps and the API give different results?","icon":"layers","href":"/en/faq/webapp-vs-api-difference"},{"title":"Why Don't AI Models Know Their Own Version?","icon":"circle-question-mark","href":"/en/faq/model-version-identity"}]}]},{"title":"Image \u0026 Video Generation Models","icon":"palette","href":"/en/api-capabilities/image-video-models"},{"group":"OpenAI API Calls","icon":"sparkles","pages":[{"title":"OpenAI Responses API Native Guide","sidebarTitle":"Native Calls","icon":"zap","href":"/en/api-capabilities/openai/native"},{"title":"OpenAI Chat Completions Compatible Mode","sidebarTitle":"Compatible Mode","icon":"plug","href":"/en/api-capabilities/openai/compatible"},{"title":"Choosing an Endpoint: Migrating GPT-5.4+ to Responses","sidebarTitle":"Endpoint \u0026 Migration","icon":"route","href":"/en/api-capabilities/openai/responses-migration"},{"title":"OpenAI Compatible Mode: Handling Responses","sidebarTitle":"Handling Responses","icon":"braces","href":"/en/api-capabilities/openai/response-handling"},{"title":"OpenAI Compatible Mode: Reasoning Model Output","sidebarTitle":"Reasoning Model Output","icon":"brain","href":"/en/api-capabilities/openai/reasoning-models"},{"title":"OpenAI Prompt Caching Billing Guide","sidebarTitle":"Cache Billing","icon":"database","href":"/en/api-capabilities/openai/prompt-caching"},{"title":"OpenAI Function Calling Guide","sidebarTitle":"Function Calling","icon":"wrench","href":"/en/api-capabilities/openai/function-calling"},{"title":"OpenAI API Web Search Guide","sidebarTitle":"Web Search","icon":"globe","href":"/en/api-capabilities/openai/web-search"},{"group":"OpenAI FAQ","icon":"circle-question-mark","pages":[{"title":"Does APIYI Support OpenAI Fast / Ultrafast Mode?","icon":"gauge","href":"/en/faq/openai-service-tier-fast-mode"},{"title":"How Do Streaming and Non-Streaming Requests Differ When Content Is Filtered?","sidebarTitle":"Streaming \u0026 Content Filtering","icon":"shield-half","href":"/en/faq/streaming-content-filter"},{"title":"What Does an OpenAI Model Refusal Look Like?","icon":"message-square-x","href":"/en/faq/openai-content-safety-refusal"}]}]},{"group":"Claude Official","icon":"sparkles","pages":[{"title":"Claude API Calling Basics","sidebarTitle":"Claude API Basics","icon":"sparkles","href":"/en/api-capabilities/claude"},{"title":"Claude Native Format: Streaming \u0026 Non-Streaming Responses","sidebarTitle":"Streaming \u0026 Responses","icon":"braces","href":"/en/api-capabilities/claude-response-handling"},{"title":"Claude Prompt Caching Guide","sidebarTitle":"Prompt Caching","icon":"database","href":"/en/api-capabilities/claude-prompt-caching"},{"title":"Claude Effort and Thinking Guide","sidebarTitle":"Claude Thinking Guide","icon":"gauge","href":"/en/api-capabilities/claude-effort-thinking"},{"title":"Claude API Web Search Guide","sidebarTitle":"Claude Web Search","icon":"globe","href":"/en/api-capabilities/claude-web-search"},{"group":"Claude FAQ","icon":"circle-question-mark","pages":[{"title":"Why Does Claude Claim to Be Qwen or DeepSeek?","icon":"venetian-mask","href":"/en/faq/claude-identity-confusion"},{"title":"How Do I Fix Claude's Invalid Thinking Signature Error?","icon":"file-signature","href":"/en/faq/claude-thinking-signature-invalid"},{"title":"Why Does a Claude Refusal Return Empty Content?","icon":"message-square-x","href":"/en/faq/claude-content-safety-refusal"}]}]},{"group":"Gemini Native Calls","icon":"sparkles","pages":[{"title":"Gemini Native Format Guide","sidebarTitle":"Native Calls","icon":"zap","href":"/en/api-capabilities/gemini/native"},{"title":"Interactions API vs generateContent","sidebarTitle":"Interactions API Compared","icon":"git-compare","href":"/en/api-capabilities/gemini/interactions-api"},{"title":"Gemini Native Format: Streaming \u0026 Non-Streaming Responses","sidebarTitle":"Streaming \u0026 Responses","icon":"braces","href":"/en/api-capabilities/gemini/response-handling"},{"title":"Gemini Multimodal Input \u0026 Code Execution","sidebarTitle":"Multimodal \u0026 Code Exec","icon":"images","href":"/en/api-capabilities/gemini/multimodal"},{"title":"Gemini Implicit Caching Billing Guide","sidebarTitle":"Cache Billing","icon":"database","href":"/en/api-capabilities/gemini/prompt-caching"},{"title":"Gemini Function Calling Guide","sidebarTitle":"Function Calling","icon":"wrench","href":"/en/api-capabilities/gemini/function-calling"},{"title":"Gemini API Web Search Guide","sidebarTitle":"Web Search","icon":"globe","href":"/en/api-capabilities/gemini/web-search"},{"title":"How Do I Fix Gemini Thought Signature 400 Errors in Tool Calls?","icon":"file-signature","href":"/en/faq/gemini-thought-signature-missing"}]},{"group":"Grok API Calls","icon":"sparkles","pages":[{"title":"Grok Model Series Guide","sidebarTitle":"Grok Overview","icon":"rocket","href":"/en/api-capabilities/grok/overview"},{"title":"Grok Chat \u0026 Reasoning Guide","sidebarTitle":"Chat \u0026 Reasoning","icon":"message-square","href":"/en/api-capabilities/grok/chat"},{"title":"Grok Web Search \u0026 X Search Guide","sidebarTitle":"Web \u0026 X Search","icon":"globe","href":"/en/api-capabilities/grok/web-search"},{"title":"Grok Code Execution \u0026 Remote MCP Guide","sidebarTitle":"Code Execution \u0026 MCP","icon":"terminal","href":"/en/api-capabilities/grok/code-execution-mcp"},{"title":"Grok Multi-Agent Model Guide","sidebarTitle":"Multi-Agent Model","icon":"users","href":"/en/api-capabilities/grok/multi-agent"},{"title":"Grok Prompt Caching Billing Guide","sidebarTitle":"Cache Billing","icon":"database","href":"/en/api-capabilities/grok/prompt-caching"}]},{"group":"Text API Best Practices","icon":"book-check","pages":[{"title":"Long-form Output Practices","sidebarTitle":"Long-form Output","icon":"book-check","href":"/en/api-capabilities/long-form-output-practices"},{"title":"Multi-Turn Conversation Guide","sidebarTitle":"Multi-Turn Conversation","icon":"messages-square","href":"/en/api-capabilities/multi-turn-conversation"},{"group":"Text FAQ","icon":"circle-question-mark","expanded":false,"pages":[{"title":"Why does a reasoning model return empty content?","icon":"alert-circle","href":"/en/faq/reasoning-model-empty-response"},{"title":"What's the difference between streaming and non-streaming calls?","sidebarTitle":"Streaming vs Non-streaming","icon":"audio-lines","href":"/en/faq/streaming-vs-non-streaming"},{"title":"What is max_tokens? What Happens If Not Set?","icon":"sliders-horizontal","href":"/en/faq/max-tokens"},{"title":"Does the API Have Memory Like ChatGPT?","icon":"brain","href":"/en/faq/api-memory"}]}]},{"title":"Balance Query API","icon":"wallet","href":"/en/api-capabilities/balance-query"},{"title":"Log Query API","icon":"file-text","href":"/en/api-capabilities/log-query"},{"title":"Token Management API","icon":"key","href":"/en/api-capabilities/token-management"},{"title":"Deprecated Models","icon":"triangle-alert","href":"/en/api-capabilities/deprecated-models"}]},{"group":"Image API (Official)","icon":"image","pages":[{"group":"Image API Essentials","icon":"book-check","pages":[{"title":"Image API Essentials \u0026 Best Practices","sidebarTitle":"Must-Read \u0026 Best Practices","icon":"book-check","href":"/en/api-capabilities/image-api-best-practices"},{"title":"Troubleshooting Image API Connection Drops","sidebarTitle":"Connection Drops","icon":"unplug","href":"/en/api-capabilities/image-connection-drops"},{"title":"Image Requests That Hang After the Data Has Arrived","sidebarTitle":"Requests Hanging at the End","icon":"hourglass","href":"/en/api-capabilities/image-tail-stall"},{"title":"Image Compression \u0026 Output Resolution","sidebarTitle":"Compression \u0026 Resolution","icon":"scaling","href":"/en/api-capabilities/image-compression-resolution"},{"title":"How to Get Satisfying Images","sidebarTitle":"Getting Satisfying Images","icon":"target","href":"/en/api-capabilities/image-generation-success-tips"},{"title":"Troubleshooting Safety Rejections: Find the Trigger Word by Ablation","sidebarTitle":"Safety Rejections","icon":"shield-alert","href":"/en/api-capabilities/image-safety-troubleshooting"},{"title":"Long Prompts and Two-Stage Generation: Where the 32K Limit Comes From","sidebarTitle":"Long Prompts","description":"A customer asked why our prompt is capped at 32K when ChatGPT is not. The documentation says 32,000 characters, but the limit that actually applies is 8,192 tokens, and exceeding it silently drops the whole prompt with no error; the web app takes long material because the chat model distills it first. Covers the limit, the cost, why longer does not mean better adherence, and a two-stage pipeline: material into a text model, prompt into the image model.","icon":"text-quote","href":"/en/api-capabilities/image-long-prompt"},{"title":"Advanced Image Generation: Workflow and Realism","sidebarTitle":"Advanced Workflow","icon":"workflow","href":"/en/api-capabilities/image-advanced-workflow"},{"title":"Image Prompt Doctor Skill","sidebarTitle":"Prompt Doctor Skill","description":"Packages the pre-generation prompt review into a drop-in Agent Skill for Codex, OpenClaw, hermes-agent, Claude Code and others: score a prompt against six elements, flag the vague words that hurt quality, and get a rewritten prompt you can use as-is. It can also review an actual result against the prompt that produced it. Defaults to gpt-5.6-luna.","icon":"stethoscope","href":"/en/api-capabilities/image-prompt-doctor"},{"group":"Image FAQ","icon":"circle-question-mark","pages":[{"title":"Can an image be rejected after generation?","sidebarTitle":"Output-image review","icon":"shield-alert","href":"/en/faq/image-output-safety-review"},{"title":"Is there a conversational API that outputs both text and generated images?","sidebarTitle":"Text + image in one API","icon":"images","href":"/en/faq/text-and-image-in-one-api"},{"title":"Image Request Hangs With No Result, but the Log Shows a Write Failure?","icon":"hourglass","href":"/en/faq/image-direct-large-response-stall"},{"title":"Image Calls Drop After About 90 Seconds Behind a Proxy?","icon":"unplug","href":"/en/faq/proxy-idle-timeout-disconnect"},{"title":"Why Does the Generated Image Differ Greatly from the Reference?","icon":"image","href":"/en/faq/image-result-differs-from-reference"},{"title":"How to fix the image content does not match MIME type error?","icon":"image","href":"/en/faq/image-mime-type-mismatch-with-query"},{"title":"Is There an Async Image API? Can I Query Results by Task ID?","icon":"image","href":"/en/faq/image-async-api"}]}]},{"group":"GPT-Image-2.6 / 2.5 / 2 Image Gen","icon":"sparkles","pages":[{"title":"GPT-Image-2.6 / 2.5 / 2 Image Generation/Edit","sidebarTitle":"GPT-Image-2.6 / 2.5 / 2 Overview","icon":"sparkles","href":"/en/api-capabilities/gpt-image-2/overview"},{"title":"GPT Image 2.6 New Capabilities","sidebarTitle":"GPT Image 2.6 Capabilities","openapi":"api-reference/gpt-image-2-6-generate-openapi-en.yaml POST /v1/images/generations","icon":"sparkles","href":"/en/api-capabilities/gpt-image-2/gpt-image-2-6"},{"title":"Text-to-Image API Reference","openapi":"api-reference/gpt-image-2-generate-openapi-en.yaml POST /v1/images/generations","icon":"wand-sparkles","href":"/en/api-capabilities/gpt-image-2/text-to-image"},{"title":"Image Edit API Reference","openapi":"api-reference/gpt-image-2-edit-openapi-en.yaml POST /v1/images/edits","icon":"image","href":"/en/api-capabilities/gpt-image-2/image-edit"},{"title":"GPT-Image-2.5 / 2 Series Agent Skill","icon":"blocks","href":"/en/api-capabilities/gpt-image-2/skills"},{"title":"Mask Inpainting Guide","sidebarTitle":"Mask Inpainting","icon":"brush","href":"/en/api-capabilities/gpt-image-2/mask-editing"},{"title":"GPT-Image Legacy Versions","sidebarTitle":"GPT-Image Legacy","icon":"rotate-ccw-clock","href":"/en/api-capabilities/gpt-image-2/historical-versions"},{"group":"GPT-Image FAQ","icon":"circle-question-mark","expanded":false,"pages":[{"title":"Which reasoning effort values work for SVG generation?","icon":"sliders-horizontal","href":"/en/faq/gpt-image-svg-reasoning-effort"},{"title":"How do I generate images with a transparent background (PNG cutouts)?","icon":"layers","href":"/en/faq/image-transparent-background"},{"title":"Why Are GPT Image Output Tokens So High?","icon":"calculator","href":"/en/faq/gpt-image-output-token-calculation"},{"title":"Codex Integration for GPT-Image Fails with Incorrect API Key","sidebarTitle":"Image Key Rejected by OpenAI","icon":"key-round","href":"/en/faq/gpt-image-incorrect-api-key-openai"}]}]},{"title":"GPT-image-2.5 / 2 Official vs Reverse","sidebarTitle":"GPT-image-2.5 / 2 Official vs Reverse","icon":"scale","href":"/en/api-capabilities/gpt-image-2/vs-gpt-image-2-all"},{"group":"GPT-Image-2.6-All Image Gen","icon":"sparkles","pages":[{"title":"GPT-Image-2.6-All Generation \u0026 Editing","sidebarTitle":"GPT-Image-2.6-All Overview","icon":"sparkles","href":"/en/api-capabilities/gpt-image-2-all/gpt-image-2-6-all"},{"title":"GPT-Image-2.5-All Image Gen/Editing","sidebarTitle":"GPT-Image-2.5-All Overview","icon":"sparkles","href":"/en/api-capabilities/gpt-image-2-all/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/gpt-image-2-all-generate-openapi-en.yaml POST /v1/images/generations","icon":"wand-sparkles","href":"/en/api-capabilities/gpt-image-2-all/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/gpt-image-2-all-edit-openapi-en.yaml POST /v1/images/edits","icon":"image","href":"/en/api-capabilities/gpt-image-2-all/image-edit"},{"title":"GPT-Image-2.5-All Agent Skill","icon":"blocks","href":"/en/api-capabilities/gpt-image-2-all/skills"}]},{"group":"GPT-Image-2.5-VIP Image Gen","icon":"expand","pages":[{"title":"GPT-Image-2.5-VIP Image Gen/Editing","sidebarTitle":"GPT-Image-2.5-VIP Overview","icon":"expand","href":"/en/api-capabilities/gpt-image-2-vip/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/gpt-image-2-vip-generate-openapi-en.yaml POST /v1/images/generations","icon":"wand-sparkles","href":"/en/api-capabilities/gpt-image-2-vip/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/gpt-image-2-vip-edit-openapi-en.yaml POST /v1/images/edits","icon":"image","href":"/en/api-capabilities/gpt-image-2-vip/image-edit"},{"title":"GPT-Image-2.5-VIP Agent Skill","icon":"blocks","href":"/en/api-capabilities/gpt-image-2-vip/skills"}]},{"title":"Nano Banana Series Pricing","icon":"tag","href":"/en/api-capabilities/nano-banana-pricing"},{"group":"NanoBanana Best Practices","icon":"lightbulb","pages":[{"title":"Nano Banana Series Developer Guide","icon":"compass","href":"/en/api-capabilities/nano-banana-dev-guide"},{"title":"Usage Fields \u0026 Output Explained","sidebarTitle":"Usage Fields \u0026 Output Explained","icon":"receipt-text","href":"/en/api-capabilities/nano-banana-usage-metadata"},{"title":"Gemini Image Generation API Error Handling Guide","icon":"triangle-alert","href":"/en/api-capabilities/gemini-image-error-handling"},{"title":"Multi-Image Fusion Testing Guide","sidebarTitle":"Multi-Image Fusion Testing","icon":"layers","href":"/en/api-capabilities/multi-image-fusion-testing"},{"title":"Nano Banana Pro Failed-Generation Credit Reimbursement Plan","icon":"shield-check","href":"/en/api-capabilities/nano-banana-pro-guarantee"},{"title":"Nano Banana OSS Group","icon":"link","href":"/en/api-capabilities/nano-banana-oss-group"},{"group":"NB FAQ","icon":"circle-question-mark","pages":[{"title":"Do Google Models Run on AI Studio or Vertex?","icon":"split","href":"/en/faq/google-upstream-aistudio-vertex"},{"title":"Image Edit Returns Unable to Process Input Image?","icon":"image-off","href":"/en/faq/gemini-empty-inlinedata"},{"title":"Why Does Gemini Image Return IMAGE_OTHER?","sidebarTitle":"IMAGE_OTHER","icon":"image-minus","href":"/en/faq/gemini-image-other"},{"title":"Why Does Gemini Image Return blockReason: OTHER?","sidebarTitle":"blockReason: OTHER","icon":"shield-alert","href":"/en/faq/gemini-image-input-blocked"},{"title":"Common Reasons for Nano Banana Image Generation Failures","icon":"image-off","href":"/en/faq/nano-banana-image-failure"},{"title":"Why Does the Gemini Image API Return NO_IMAGE?","icon":"image-off","href":"/en/faq/gemini-no-image"},{"title":"Why does my image turn reddish after editing with banana pro?","icon":"image","href":"/en/faq/banana-pro-edit-red-cast"},{"title":"How to fix distorted prints when changing outfits with Nano Banana Pro?","icon":"shirt","href":"/en/faq/nano-banana-pro-print-distortion"},{"title":"Why Does a White-Background Image Show Black Spots, Dirty Patches, or Blurry Color Blocks?","icon":"triangle-alert","href":"/en/faq/white-background-image-artifacts"}]}]},{"group":"Nano Banana 2.1 Image Gen","icon":"banana","pages":[{"title":"Nano Banana 2.1 Image Gen/Editing","icon":"banana","href":"/en/api-capabilities/gemini-nano-banana-2.1/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/gemini-nano-banana-2.1-generate-openapi-en.yaml POST /v1beta/models/gemini-nano-banana-2.1:generateContent","icon":"wand-sparkles","href":"/en/api-capabilities/gemini-nano-banana-2.1/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/gemini-nano-banana-2.1-edit-openapi-en.yaml POST /v1beta/models/gemini-nano-banana-2.1:generateContent","icon":"image","href":"/en/api-capabilities/gemini-nano-banana-2.1/image-edit"},{"title":"Nano Banana 2.1 Agent Skill","icon":"blocks","href":"/en/api-capabilities/gemini-nano-banana-2.1/skills"}]},{"group":"Nano Banana Pro Image Gen","icon":"banana","pages":[{"title":"Nano Banana Pro Image Generation","icon":"banana","href":"/en/api-capabilities/nano-banana-image/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/nano-banana-pro-generate-openapi-en.yaml POST /v1beta/models/gemini-3-pro-image:generateContent","icon":"wand-sparkles","href":"/en/api-capabilities/nano-banana-image/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/nano-banana-pro-edit-openapi-en.yaml POST /v1beta/models/gemini-3-pro-image:generateContent","icon":"image","href":"/en/api-capabilities/nano-banana-image/image-edit"},{"title":"Nano Banana Pro Agent Skill","icon":"blocks","href":"/en/api-capabilities/nano-banana-image/skills"}]},{"group":"Nano Banana 2 Image Gen","icon":"banana","pages":[{"title":"Nano Banana 2 Image Gen/Editing","icon":"banana","href":"/en/api-capabilities/nano-banana-2-image/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/nano-banana-2-generate-openapi-en.yaml POST /v1beta/models/gemini-3.1-flash-image:generateContent","icon":"wand-sparkles","href":"/en/api-capabilities/nano-banana-2-image/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/nano-banana-2-edit-openapi-en.yaml POST /v1beta/models/gemini-3.1-flash-image:generateContent","icon":"image","href":"/en/api-capabilities/nano-banana-2-image/image-edit"},{"title":"Nano Banana 2 Agent Skill","icon":"blocks","href":"/en/api-capabilities/nano-banana-2-image/skills"}]},{"group":"Nano Banana Lite Image Gen","icon":"banana","pages":[{"title":"Nano Banana Lite Image Gen/Editing","icon":"banana","href":"/en/api-capabilities/nano-banana-lite-image/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/nano-banana-lite-generate-openapi-en.yaml POST /v1beta/models/gemini-3.1-flash-lite-image:generateContent","icon":"wand-sparkles","href":"/en/api-capabilities/nano-banana-lite-image/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/nano-banana-lite-edit-openapi-en.yaml POST /v1beta/models/gemini-3.1-flash-lite-image:generateContent","icon":"image","href":"/en/api-capabilities/nano-banana-lite-image/image-edit"},{"title":"Nano Banana Lite Agent Skill","icon":"blocks","href":"/en/api-capabilities/nano-banana-lite-image/skills"}]},{"group":"FLUX Image Generation \u0026 Editing","icon":"sparkles","pages":[{"title":"FLUX Image Generation \u0026 Editing","sidebarTitle":"FLUX Overview","icon":"sparkles","href":"/en/api-capabilities/flux/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/flux-generate-openapi-en.yaml POST /v1/images/generations","icon":"wand-sparkles","href":"/en/api-capabilities/flux/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/flux-edit-openapi-en.yaml POST /v1/images/generations","icon":"image","href":"/en/api-capabilities/flux/image-edit"},{"title":"FLUX Historical Versions","sidebarTitle":"Historical Versions","icon":"rotate-ccw-clock","href":"/en/api-capabilities/flux/historical-versions"}]},{"group":"Seedream 5.0 Series","icon":"sparkles","pages":[{"title":"Seedream Image Generation \u0026 Editing","sidebarTitle":"Seedream Overview","icon":"sparkles","href":"/en/api-capabilities/seedream-image/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/seedream-image-generate-openapi-en.yaml POST /v1/images/generations","icon":"wand-sparkles","href":"/en/api-capabilities/seedream-image/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/seedream-image-edit-openapi-en.yaml POST /v1/images/generations","icon":"image","href":"/en/api-capabilities/seedream-image/image-edit"},{"title":"Seedream Historical Versions","sidebarTitle":"Historical Versions","icon":"rotate-ccw-clock","href":"/en/api-capabilities/seedream-image/historical-versions"}]},{"group":"Grok Imagine Official Image Gen","icon":"sparkles","pages":[{"title":"Grok Imagine Official Image Generation","sidebarTitle":"Grok Imagine Official Overview","icon":"sparkles","href":"/en/api-capabilities/grok-imagine-image-official/overview"},{"title":"Grok Imagine Official Text-to-Image API Reference","sidebarTitle":"Text-to-Image","openapi":"api-reference/grok-imagine-image-official-generate-openapi-en.yaml POST /v1/images/generations","icon":"wand-sparkles","href":"/en/api-capabilities/grok-imagine-image-official/text-to-image"}]},{"group":"Grok Imagine Reverse Image Gen \u0026 Editing","icon":"sparkles","pages":[{"title":"Grok Imagine Reverse Image Gen \u0026 Editing","sidebarTitle":"Grok Imagine Reverse Overview","icon":"sparkles","href":"/en/api-capabilities/grok-imagine-image/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/grok-imagine-image-generate-openapi-en.yaml POST /v1/images/generations","icon":"wand-sparkles","href":"/en/api-capabilities/grok-imagine-image/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/grok-imagine-image-edit-openapi-en.yaml POST /v1/images/edits","icon":"image","href":"/en/api-capabilities/grok-imagine-image/image-edit"}]},{"group":"MAI-Image 2.6 Image Gen \u0026 Editing","icon":"sparkles","pages":[{"title":"MAI-Image 2.6 Image Gen \u0026 Editing","sidebarTitle":"MAI-Image 2.6 Overview","icon":"sparkles","href":"/en/api-capabilities/mai-image/overview"},{"title":"Text-to-Image API Reference","openapi":"api-reference/mai-image-generate-openapi-en.yaml POST /v1/images/generations","icon":"wand-sparkles","href":"/en/api-capabilities/mai-image/text-to-image"},{"title":"Image Editing API Reference","openapi":"api-reference/mai-image-edit-openapi-en.yaml POST /v1/images/edits","icon":"image","href":"/en/api-capabilities/mai-image/image-edit"}]},{"title":"Image API Integration Practice: Build Your Own Async Queue","sidebarTitle":"Self-Hosted Async Queue","icon":"list-checks","href":"/en/api-capabilities/image-async-queue"}]},{"group":"Video API (Official)","icon":"video","pages":[{"group":"Seedance 2.0 / 2.5 (Volcengine)","icon":"film","pages":[{"title":"Seedance 2.0 / 2.5 Video Generation","sidebarTitle":"Seedance 2.0 / 2.5 Overview","icon":"film","href":"/en/api-capabilities/seedance2/overview"},{"title":"Seedance 2.0 / 2.5 Video Generation API Reference","sidebarTitle":"Video Generation","openapi":"api-reference/seedance2-video-openapi-en.yaml POST /seedance/api/v3/contents/generations/tasks","icon":"video","href":"/en/api-capabilities/seedance2/video-generation"},{"title":"Seedance 2.0 Video Agent Skill","icon":"blocks","href":"/en/api-capabilities/seedance2/skills"},{"title":"Seedance 2.0 Asset Library (Character-Consistent Video)","sidebarTitle":"Asset Library","icon":"images","href":"/en/api-capabilities/seedance2/asset-library"},{"title":"Asset-Referenced Video Generation in Code","sidebarTitle":"Asset Reference Guide","icon":"clapperboard","href":"/en/api-capabilities/seedance2/asset-reference"},{"title":"Asset-First: Faster, More Reliable Image and Video Inputs","sidebarTitle":"Asset-First Workflow","icon":"gauge","href":"/en/api-capabilities/seedance2/asset-first-workflow"},{"group":"SD FAQ","icon":"circle-question-mark","pages":[{"title":"Seedance Says First/Last Frame Cannot Be Mixed with Reference Media","sidebarTitle":"First Frame Mixed with Reference","icon":"layers","href":"/en/faq/seedance-first-frame-mixed-with-reference"},{"title":"Seedance Says invalid image format, but the Link Opens in a Browser","sidebarTitle":"Image Link Opens but Fails","icon":"link","href":"/en/faq/seedance-image-url-invalid-format"},{"title":"Seedance 2.5: Reference-to-Video vs. Video Editing","icon":"split","href":"/en/faq/seedance2-reference-vs-edit"},{"title":"Can I Cancel a Seedance Video Task After Submission?","icon":"video","href":"/en/faq/seedance-video-task-cancel"},{"title":"How do I look up a Seedance video's real cost by task_id?","icon":"receipt","href":"/en/faq/seedance-task-cost-lookup"},{"title":"Does Seedance 2.0 auto-upload face references to the asset library? Does it trigger the deepfake filter?","icon":"banana","href":"/en/faq/seedance2-asset-face-reference"},{"title":"Why Does Seedance 2.0 / 2.5 Block Face Assets?","icon":"scan-face","href":"/en/faq/seedance2-face-asset-whitelist"}]}]},{"group":"Wan3.0 Video Generation (Alibaba)","icon":"video","pages":[{"title":"Wan3.0 Video Generation (Alibaba Tongyi Wanxiang)","sidebarTitle":"Overview","icon":"video","href":"/en/api-capabilities/wan3/overview"},{"title":"Wan3.0 Video Generation API Reference","sidebarTitle":"Video Generation","openapi":"api-reference/wan3-video-openapi-en.yaml POST /wan/api/v1/services/aigc/video-generation/video-synthesis","icon":"wand-sparkles","href":"/en/api-capabilities/wan3/video-generation"},{"title":"Wan3.0 Failed to download: why the source media URL fails and how to fix it","sidebarTitle":"Media Download Failures","icon":"circle-question-mark","href":"/en/faq/wan3-media-download-failed"}]},{"group":"Wan2.7 Video Generation (Alibaba)","icon":"videotape","pages":[{"title":"Wan Video Generation (Alibaba Cloud Tongyi Wanxiang)","sidebarTitle":"Wan Overview","icon":"video","href":"/en/api-capabilities/wan/overview"},{"title":"Wan2.7 Text-to-Video API Reference","sidebarTitle":"Text-to-Video","openapi":"api-reference/wan-text-to-video-openapi-en.yaml POST /wan/api/v1/services/aigc/video-generation/video-synthesis","icon":"wand-sparkles","href":"/en/api-capabilities/wan/text-to-video"},{"title":"Wan2.7 Image-to-Video API Reference","sidebarTitle":"Image-to-Video","openapi":"api-reference/wan-image-to-video-openapi-en.yaml POST /wan/api/v1/services/aigc/video-generation/video-synthesis","icon":"image","href":"/en/api-capabilities/wan/image-to-video"},{"title":"Wan2.7 Reference-to-Video API Reference","sidebarTitle":"Reference-to-Video","openapi":"api-reference/wan-reference-to-video-openapi-en.yaml POST /wan/api/v1/services/aigc/video-generation/video-synthesis","icon":"users","href":"/en/api-capabilities/wan/reference-to-video"},{"title":"Wan2.7 Video Edit API Reference","sidebarTitle":"Video Edit","openapi":"api-reference/wan-video-edit-openapi-en.yaml POST /wan/api/v1/services/aigc/video-generation/video-synthesis","icon":"scissors","href":"/en/api-capabilities/wan/video-edit"},{"title":"Wan2.7 and HappyHorse Video Agent Skill","icon":"blocks","href":"/en/api-capabilities/wan/skills"},{"title":"Wan Historical Versions (Wan2.6)","sidebarTitle":"Historical Versions","icon":"rotate-ccw-clock","href":"/en/api-capabilities/wan/historical-versions"}]},{"group":"HappyHorse Video Generation (Alibaba)","icon":"monitor-play","pages":[{"title":"HappyHorse Video Generation (Alibaba Cloud)","sidebarTitle":"HappyHorse Overview","icon":"monitor-play","href":"/en/api-capabilities/happyhorse/overview"},{"title":"HappyHorse Text-to-Video API Reference","sidebarTitle":"Text-to-Video","openapi":"api-reference/happyhorse-text-to-video-openapi-en.yaml POST /wan/api/v1/services/aigc/video-generation/video-synthesis","icon":"wand-sparkles","href":"/en/api-capabilities/happyhorse/text-to-video"},{"title":"HappyHorse Image-to-Video API Reference","sidebarTitle":"Image-to-Video","openapi":"api-reference/happyhorse-image-to-video-openapi-en.yaml POST /wan/api/v1/services/aigc/video-generation/video-synthesis","icon":"image","href":"/en/api-capabilities/happyhorse/image-to-video"},{"title":"HappyHorse Reference-to-Video API Reference","sidebarTitle":"Reference-to-Video","openapi":"api-reference/happyhorse-reference-to-video-openapi-en.yaml POST /wan/api/v1/services/aigc/video-generation/video-synthesis","icon":"users","href":"/en/api-capabilities/happyhorse/reference-to-video"},{"title":"HappyHorse Video Edit API Reference","sidebarTitle":"Video Edit","openapi":"api-reference/happyhorse-video-edit-openapi-en.yaml POST /wan/api/v1/services/aigc/video-generation/video-synthesis","icon":"scissors","href":"/en/api-capabilities/happyhorse/video-edit"},{"title":"HappyHorse Video Agent Skill","icon":"blocks","href":"/en/api-capabilities/happyhorse/skills"}]},{"group":"Grok Imagine Video (xAI)","icon":"camera","pages":[{"title":"Grok Imagine Video Generation","sidebarTitle":"Grok Imagine Video Overview","icon":"video","href":"/en/api-capabilities/grok-imagine-video/overview"},{"title":"Grok Imagine Video Generation API Reference","sidebarTitle":"Video Generation","openapi":"api-reference/grok-imagine-video-openapi-en.yaml POST /v1/videos","icon":"wand-sparkles","href":"/en/api-capabilities/grok-imagine-video/video-generation"}]},{"group":"MiniMax H3 Video Generation (Self-hosted)","icon":"film","pages":[{"title":"MiniMax-H3 Video Generation","sidebarTitle":"MiniMax-H3 Overview","icon":"video","href":"/en/api-capabilities/minimax-h3/overview"},{"title":"MiniMax-H3 Video Generation API Reference","sidebarTitle":"Video Generation","openapi":"api-reference/minimax-h3-video-openapi-en.yaml POST /hailuo/v2/video_generation","icon":"video","href":"/en/api-capabilities/minimax-h3/video-generation"}]},{"group":"Oxygen Video Generation (AZ8)","icon":"clapperboard","pages":[{"title":"Oxygen Video Generation","sidebarTitle":"Oxygen Overview","icon":"video","href":"/en/api-capabilities/oxygen/overview"},{"title":"Oxygen Video Generation API Reference","sidebarTitle":"Video Generation","openapi":"api-reference/oxygen-video-openapi-en.yaml POST /videos","icon":"video","href":"/en/api-capabilities/oxygen/video-generation"}]}]},{"group":"Multimodal Understanding API","icon":"eye","pages":[{"group":"Image Understanding API","icon":"eye","root":{"title":"Vision Understanding (Image Recognition) API","icon":"eye","href":"/en/api-capabilities/vision-understanding"},"pages":[{"group":"Vision FAQ","icon":"circle-help","expanded":false,"pages":[{"title":"Image Understanding Requests Keep Timing Out — Is the Image Too Large?","icon":"image","href":"/en/faq/vision-image-too-large"}]}]},{"title":"Video Understanding API","icon":"video","href":"/en/api-capabilities/video-understanding"}]},{"group":"Text Generation","icon":"file-text","pages":[{"title":"Text Generation (Chat Completions)","icon":"message-square","href":"/en/api-capabilities/text-generation"},{"group":"Gemini 4 Carbon","icon":"sparkles","pages":[{"title":"Gemini 4 Carbon Text Generation","sidebarTitle":"Gemini 4 Carbon Overview","icon":"sparkles","href":"/en/api-capabilities/gemini-4-carbon/overview"}]},{"group":"Gemini 4 Argon","icon":"sparkles","pages":[{"title":"Gemini 4 Argon Text Generation","sidebarTitle":"Gemini 4 Argon Overview","icon":"sparkles","href":"/en/api-capabilities/gemini-4-argon/overview"}]},{"group":"GPT-6 Astra","icon":"sparkles","pages":[{"title":"GPT-6 Astra Text Generation","sidebarTitle":"GPT-6 Astra Overview","icon":"sparkles","href":"/en/api-capabilities/gpt-6-astra/overview"}]},{"group":"DeepSeek V4 Flash Vision","icon":"eye","pages":[{"title":"DeepSeek V4 Flash Vision","sidebarTitle":"Overview","icon":"eye","href":"/en/api-capabilities/deepseek-v4-flash-vision/overview"},{"title":"DeepSeek V4 Flash Vision Chat API Reference","sidebarTitle":"Chat Playground","openapi":"api-reference/deepseek-v4-flash-vision-chat-openapi-en.yaml POST /v1/chat/completions","icon":"terminal","href":"/en/api-capabilities/deepseek-v4-flash-vision/chat-completions"},{"title":"DeepSeek V4 Flash Vision Messages API Reference","sidebarTitle":"Messages Playground","openapi":"api-reference/deepseek-v4-flash-vision-messages-openapi-en.yaml POST /v1/messages","icon":"terminal","href":"/en/api-capabilities/deepseek-v4-flash-vision/messages"}]},{"group":"DeepSeek V4 Flash","icon":"zap","pages":[{"title":"DeepSeek V4 Flash Text Generation","sidebarTitle":"Overview","icon":"zap","href":"/en/api-capabilities/deepseek-v4-flash/overview"},{"title":"DeepSeek V4 Flash Chat API Reference","sidebarTitle":"Chat Playground","openapi":"api-reference/deepseek-v4-flash-chat-openapi-en.yaml POST /v1/chat/completions","icon":"terminal","href":"/en/api-capabilities/deepseek-v4-flash/chat-completions"},{"title":"DeepSeek V4 Flash Responses API Reference","sidebarTitle":"Responses Playground","openapi":"api-reference/deepseek-v4-flash-responses-openapi-en.yaml POST /v1/responses","icon":"git-fork","href":"/en/api-capabilities/deepseek-v4-flash/responses"}]},{"group":"DeepSeek Search \u0026 Fetch","icon":"search","pages":[{"title":"DeepSeek Web Search and Fetch API","sidebarTitle":"Overview","icon":"search","href":"/en/api-capabilities/deepseek-search-fetch/overview"},{"title":"DeepSeek Web Search API Reference","sidebarTitle":"Search Playground","openapi":"api-reference/deepseek-search-openapi-en.yaml POST /v1/tools/search","icon":"terminal","href":"/en/api-capabilities/deepseek-search-fetch/search-api"},{"title":"DeepSeek Web Fetch API Reference","sidebarTitle":"Fetch Playground","openapi":"api-reference/deepseek-fetch-openapi-en.yaml POST /v1/tools/fetch","icon":"terminal","href":"/en/api-capabilities/deepseek-search-fetch/fetch-api"}]},{"group":"Seed 2.1 Turbo","icon":"zap","pages":[{"title":"Seed 2.1 Turbo Text Generation","sidebarTitle":"Overview","icon":"message-square","href":"/en/api-capabilities/dola-seed-2-1-turbo/overview"},{"title":"Seed 2.1 Turbo Chat API Reference","sidebarTitle":"Chat Playground","openapi":"api-reference/dola-seed-2-1-turbo-chat-openapi-en.yaml POST /v1/chat/completions","icon":"terminal","href":"/en/api-capabilities/dola-seed-2-1-turbo/chat-completions"},{"title":"Seed 2.1 Turbo Responses API Reference","sidebarTitle":"Responses Playground","openapi":"api-reference/dola-seed-2-1-turbo-responses-openapi-en.yaml POST /v1/responses","icon":"messages-square","href":"/en/api-capabilities/dola-seed-2-1-turbo/responses"}]},{"group":"Gemini Flash Series","icon":"sparkles","pages":[{"title":"Gemini 3.8 Flash Text Generation","sidebarTitle":"Gemini 3.8 Flash Overview","icon":"sparkles","href":"/en/api-capabilities/gemini-3-8-flash/overview"},{"title":"Gemini 3.6 Flash Text Generation","sidebarTitle":"Gemini 3.6 Flash Overview","icon":"sparkles","href":"/en/api-capabilities/gemini-3-6-flash/overview"},{"title":"Gemini 3.6 Flash Native API Reference","sidebarTitle":"3.6 Native Playground","openapi":"api-reference/gemini-3-6-flash-native-openapi-en.yaml POST /v1beta/models/gemini-3.6-flash:generateContent","icon":"terminal","href":"/en/api-capabilities/gemini-3-6-flash/generate-content"},{"title":"Gemini 3.6 Flash Chat API Reference","sidebarTitle":"3.6 Chat Playground","openapi":"api-reference/gemini-3-6-flash-chat-openapi-en.yaml POST /v1/chat/completions","icon":"terminal","href":"/en/api-capabilities/gemini-3-6-flash/chat-completions"}]},{"group":"Gemini 3.5 Flash-Lite","icon":"feather","pages":[{"title":"Gemini 3.5 Flash-Lite Text Generation","sidebarTitle":"Overview","icon":"feather","href":"/en/api-capabilities/gemini-3-5-flash-lite/overview"},{"title":"Gemini 3.5 Flash-Lite Native API Reference","sidebarTitle":"Native Playground","openapi":"api-reference/gemini-3-5-flash-lite-native-openapi-en.yaml POST /v1beta/models/gemini-3.5-flash-lite:generateContent","icon":"terminal","href":"/en/api-capabilities/gemini-3-5-flash-lite/generate-content"},{"title":"Gemini 3.5 Flash-Lite Chat API Reference","sidebarTitle":"Chat Playground","openapi":"api-reference/gemini-3-5-flash-lite-chat-openapi-en.yaml POST /v1/chat/completions","icon":"terminal","href":"/en/api-capabilities/gemini-3-5-flash-lite/chat-completions"}]},{"group":"Qwen3 Series","icon":"puzzle","pages":[{"title":"Qwen3.8-Max Text Generation","sidebarTitle":"Overview","icon":"puzzle","href":"/en/api-capabilities/qwen-3-8/overview"},{"title":"Qwen3.8-Max Chat API Reference","sidebarTitle":"Chat Playground","openapi":"api-reference/qwen-3-8-max-chat-openapi-en.yaml POST /v1/chat/completions","icon":"terminal","href":"/en/api-capabilities/qwen-3-8/chat-completions"},{"title":"Qwen3.6 Text Model Series (Legacy)","sidebarTitle":"Qwen3.6 (Legacy)","icon":"puzzle","href":"/en/api-capabilities/qwen-3-6/overview"}]},{"group":"Kimi K3.1 Pro","icon":"moon","pages":[{"title":"Kimi K3.1 Pro Overview","sidebarTitle":"Overview","icon":"brain","href":"/en/api-capabilities/kimi-k3-1/overview"}]},{"title":"Kimi K2.5 Text Generation","sidebarTitle":"Kimi K2.5","icon":"bot","href":"/en/api-capabilities/kimi-k2-5"}]},{"group":"Audio API (Official)","icon":"audio-lines","pages":[{"title":"Realtime Voice (WebSocket)","sidebarTitle":"Realtime Voice Overview","icon":"audio-lines","href":"/en/api-capabilities/realtime/overview"}]},{"group":"Retrieval \u0026 Safety","icon":"search","pages":[{"title":"Text Embedding API","icon":"vector-square","href":"/en/api-capabilities/text-embedding"},{"title":"Embedding Tuning in Practice","sidebarTitle":"Embedding Tuning","icon":"sliders-horizontal","href":"/en/api-capabilities/embedding-best-practices"},{"group":"Rerank","icon":"list-ordered","pages":[{"title":"bge-reranker-v2-m3 Text Reranking","sidebarTitle":"Overview","icon":"list-ordered","href":"/en/api-capabilities/rerank/overview"},{"title":"Rerank API Reference","sidebarTitle":"Playground","openapi":"api-reference/bge-reranker-v2-m3-rerank-openapi-en.yaml POST /v1/rerank","icon":"terminal","href":"/en/api-capabilities/rerank/rerank-api"},{"title":"RAG Tuning in Practice","sidebarTitle":"RAG Tuning","icon":"sliders-horizontal","href":"/en/api-capabilities/rerank/rag-best-practices"}]},{"title":"Text Moderation","icon":"shield-check","href":"/en/api-capabilities/text-moderation"}]}]},{"tab":"Use Cases","icon":"layout-grid","pages":[{"title":"Use Cases","href":"/en/scenarios"}]},{"tab":"FAQ","icon":"circle-question-mark","pages":[{"title":"FAQ","href":"/en/faq"}]},{"tab":"Live Updates","icon":"activity","pages":[{"title":"Live Updates","href":"/en/live"}]},{"tab":"Announcements","icon":"megaphone","pages":[{"title":"Announcements","href":"/en/changelog"}]},{"tab":"Promotions","icon":"gift","pages":[{"title":"Promotions","href":"/en/faq/recharge-promotions"}]},{"tab":"Model Pricing","icon":"circle-dollar-sign","pages":[{"title":"Model Pricing","href":"/en/models"}]}]},{"language":"zh-Hant","banner":{"content":"本頁由程式自動轉換為繁體中文,用詞以台灣正體為準;如有歧義請以[簡體中文版](/)為準。","dismissible":true},"footer":{"socials":{"website":"https://api.apiyi.com"},"links":[{"header":"AI 整合","items":[{"label":"skill.md","href":"https://docs.apiyi.com/skill.md"},{"label":"llms.txt","href":"https://docs.apiyi.com/llms.txt"},{"label":"llms-full.txt","href":"https://docs.apiyi.com/llms-full.txt"},{"label":"model-registry.json","href":"https://docs.apiyi.com/model-registry.json"},{"label":"AI 開發者套件(中文)","href":"/developer-kit"},{"label":"AI Developer Kit (EN)","href":"/en/developer-kit"}]},{"header":"使用者口碑 / Wall of Love","items":[{"label":"使用者口碑(中文)","href":"/wall-of-love"},{"label":"Wall of Love (EN)","href":"/en/wall-of-love"}]}]},"navbar":{"links":[{"href":"https://api.apiyi.com","label":"首頁"},{"href":"https://imagen.apiyi.com","label":"AI出圖"},{"href":"https://icover.ai","label":"AI影片"}],"primary":{"type":"button","label":"控制台","href":"https://api.apiyi.com/account/profile"}},"pages":[{"title":"zh-Hant","href":"/zh-Hant/api-capabilities/image-advanced-workflow"}]},{"language":"ja","banner":{"content":"このページは AI により翻訳されています。内容に相違がある場合は[English 版](/en)を正としてください。","dismissible":true},"footer":{"socials":{"website":"https://api.apiyi.com"},"links":[{"header":"AI統合","items":[{"label":"skill.md","href":"https://docs.apiyi.com/skill.md"},{"label":"llms.txt","href":"https://docs.apiyi.com/llms.txt"},{"label":"llms-full.txt","href":"https://docs.apiyi.com/llms-full.txt"},{"label":"model-registry.json","href":"https://docs.apiyi.com/model-registry.json"},{"label":"AI開発者キット(中国語)","href":"/developer-kit"},{"label":"AI Developer Kit (EN)","href":"/en/developer-kit"}]},{"header":"ユーザーの声 / Wall of Love","items":[{"label":"ユーザーの声(中国語)","href":"/wall-of-love"},{"label":"Wall of Love(英語)","href":"/en/wall-of-love"}]}]},"navbar":{"links":[{"href":"https://api.apiyi.com","label":"ホーム"},{"href":"https://imagen.apiyi.com","label":"AI画像生成"},{"href":"https://icover.ai","label":"AI動画生成"}],"primary":{"type":"button","label":"コンソール","href":"https://api.apiyi.com/account/profile"}},"pages":[{"title":"ja","href":"/ja/api-capabilities/image-advanced-workflow"}]},{"language":"ko","banner":{"content":"이 페이지는 AI로 번역되었습니다. 내용이 다를 경우 [English 버전](/en)을 기준으로 하십시오.","dismissible":true},"footer":{"socials":{"website":"https://api.apiyi.com"},"links":[{"header":"AI 통합","items":[{"label":"skill.md","href":"https://docs.apiyi.com/skill.md"},{"label":"llms.txt","href":"https://docs.apiyi.com/llms.txt"},{"label":"llms-full.txt","href":"https://docs.apiyi.com/llms-full.txt"},{"label":"model-registry.json","href":"https://docs.apiyi.com/model-registry.json"},{"label":"AI 개발자 키트(중국어)","href":"/developer-kit"},{"label":"AI Developer Kit (EN)","href":"/en/developer-kit"}]},{"header":"사용자 후기 / Wall of Love","items":[{"label":"사용자 후기(중국어)","href":"/wall-of-love"},{"label":"Wall of Love (영문)","href":"/en/wall-of-love"}]}]},"navbar":{"links":[{"href":"https://api.apiyi.com","label":"홈"},{"href":"https://imagen.apiyi.com","label":"AI 이미지 생성"},{"href":"https://icover.ai","label":"AI 동영상 생성"}],"primary":{"type":"button","label":"콘솔","href":"https://api.apiyi.com/account/profile"}},"pages":[{"title":"ko","href":"/ko/api-capabilities/image-advanced-workflow"}]},{"language":"ru","banner":{"content":"Эта страница переведена с помощью ИИ. При расхождениях ориентируйтесь на [английскую версию](/en).","dismissible":true},"footer":{"socials":{"website":"https://api.apiyi.com"},"links":[{"header":"AI-интеграция","items":[{"label":"skill.md","href":"https://docs.apiyi.com/skill.md"},{"label":"llms.txt","href":"https://docs.apiyi.com/llms.txt"},{"label":"llms-full.txt","href":"https://docs.apiyi.com/llms-full.txt"},{"label":"model-registry.json","href":"https://docs.apiyi.com/model-registry.json"},{"label":"Набор AI-разработчика (кит.)","href":"/developer-kit"},{"label":"AI Developer Kit (EN)","href":"/en/developer-kit"}]},{"header":"Отзывы пользователей / Wall of Love","items":[{"label":"Отзывы пользователей (на китайском)","href":"/wall-of-love"},{"label":"Wall of Love (EN)","href":"/en/wall-of-love"}]}]},"navbar":{"links":[{"href":"https://api.apiyi.com","label":"Главная"},{"href":"https://imagen.apiyi.com","label":"Генерация изображений"},{"href":"https://icover.ai","label":"Генерация видео"}],"primary":{"type":"button","label":"Консоль","href":"https://api.apiyi.com/account/profile"}},"pages":[{"title":"ru","href":"/ru/api-capabilities/image-advanced-workflow"}]}]},"basePath":"","title":"Advanced Image Generation: Workflow and Realism - API易文档中心","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":["10e4515597","07c022d89b","a74be98ba7"],"chunks":["BannerMarkdown-DV3Oq1fY.js","dist-C-XZBk9h.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-D3Isdib3.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","Frame-u3J1-UOn.js","DynamicMarkdown-B-f2cqXQ.js","zoom-image-lightbox-DTFzvaXJ.js","lightbox-handle-r17bVUz3.js"]}