Product appearance consistency
Whether the product’s shape, proportions, colors, logo, and packaging text remain consistent.
model guide
gpt-image-2-vip
Uses the OpenAI Images API with exact pixel-size choices, image editing, and three quality levels.
These are the settings currently available in YingTu.
A minimal coffee poster with the exact headline “COFFEE MADE SIMPLE”, high contrast type, warm natural light, clean commercial layout.
A clean e-commerce banner with a centered product, generous copy space, neutral background, and precise visual hierarchy.
A polished onboarding illustration with a simple interface motif, restrained colors, crisp shapes, and generous negative space.
These are the settings currently available in the Image Studio.
This example uses the same request format as the Image Studio.
import base64
import mimetypes
import os
import sys
import requests
API_KEY = os.environ.get("LAOZHANG_API_KEY")
if not API_KEY:
raise RuntimeError("Set the LAOZHANG_API_KEY environment variable before running this example.")
REQUEST_TIMEOUT_SECONDS = 500
headers = {"Authorization": f"Bearer {API_KEY}"}
def extension_for_mime(mime_type):
return {
"image/jpeg": "jpg",
"image/png": "png",
"image/webp": "webp",
"image/gif": "gif",
}.get(mime_type, "bin")
def decode_base64_image(value, fallback_mime="image/png"):
mime_type = fallback_mime
encoded = value
if value.startswith("data:"):
header, encoded = value.split(",", 1)
mime_type = header[5:].split(";", 1)[0] or fallback_mime
return base64.b64decode(encoded, validate=True), mime_type
def parse_json_response(response):
try:
result = response.json()
except ValueError as error:
print("API returned a non-JSON response.", file=sys.stderr)
raise SystemExit(1) from error
if not isinstance(result, dict):
print("API returned an unexpected JSON shape.", file=sys.stderr)
raise SystemExit(1)
return result
def extract_image(result):
if not isinstance(result, dict):
return None
images = result.get("data") or []
first_image = images[0] if images and isinstance(images[0], dict) else {}
encoded = first_image.get("b64_json")
if isinstance(encoded, str) and encoded:
return decode_base64_image(encoded)
image_url = first_image.get("url")
if isinstance(image_url, str) and image_url:
image_response = requests.get(image_url, timeout=REQUEST_TIMEOUT_SECONDS)
image_response.raise_for_status()
mime_type = image_response.headers.get("Content-Type", "image/png").split(";", 1)[0]
return image_response.content, mime_type
return None
def save_result_image(result):
extracted = extract_image(result)
if not extracted:
keys = sorted(result.keys()) if isinstance(result, dict) else []
print(f"No image data in response. Top-level keys: {keys}", file=sys.stderr)
raise SystemExit(1)
image_bytes, mime_type = extracted
output_path = f"output.{extension_for_mime(mime_type)}"
with open(output_path, "wb") as output_file:
output_file.write(image_bytes)
print(f"Image saved: {output_path} ({mime_type})")
API_URL = "https://api2.laozhang.ai/v1/images/generations"
headers["Content-Type"] = "application/json"
payload = {
"model": "gpt-image-2-vip",
"prompt": "A minimal coffee poster with the exact headline “COFFEE MADE SIMPLE”, high contrast type, warm natural light, clean commercial layout.",
"size": "2048x2048",
"quality": "high"
}
try:
response = requests.post(
API_URL,
headers=headers,
json=payload,
timeout=REQUEST_TIMEOUT_SECONDS,
)
except requests.Timeout as error:
print(
"Request timed out after 500 seconds. The result status may be unknown; "
"check call and billing logs before retrying.",
file=sys.stderr,
)
raise SystemExit(1) from error
if response.status_code != 200:
print(f"API error {response.status_code}: {response.text}", file=sys.stderr)
raise SystemExit(1)
save_result_image(parse_json_response(response))
These gallery images do not include the model or prompt used to create them. They are visual examples, not test results for this model.



Test record
This section shows only YingTu test results that are ready for public review. When no result is available, we say so instead of showing draft data.
Whether the product’s shape, proportions, colors, logo, and packaging text remain consistent.
Whether the subject and its edges remain intact while only the requested background changes.