Product appearance consistency
Whether the product’s shape, proportions, colors, logo, and packaging text remain consistent.
model guide
gemini-3.1-flash-image
A balanced image route for everyday generation and image editing, with multiple output sizes and aspect ratios exposed by the current Studio configuration.
These are the settings currently available in YingTu.
A clean product photo of a matte ceramic coffee mug on a light stone table, soft window light, natural shadows, minimal styling.
An editorial travel photograph of a mountain lake at sunrise, layered atmospheric depth, natural color, fine detail.
Preserve the main subject and composition. Replace the background with a quiet modern studio using soft directional daylight.
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.")
API_URL = "https://api2.laozhang.ai/v1beta/models/gemini-3.1-flash-image:generateContent"
REQUEST_TIMEOUT_SECONDS = 500
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
payload = {
"contents": [{
"parts": [
{"text": "A clean product photo of a matte ceramic coffee mug on a light stone table, soft window light, natural shadows, minimal styling."}
]
}],
"generationConfig": {
"responseModalities": ["IMAGE"],
"imageConfig": {
"imageSize": "2K"
}
}
}
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)
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)
image_part = None
for candidate in result.get("candidates", []):
for part in candidate.get("content", {}).get("parts", []):
inline_data = part.get("inlineData") or part.get("inline_data")
if inline_data and inline_data.get("data"):
image_part = inline_data
break
if image_part:
break
if not image_part:
response_id = result.get("responseId", "not provided")
print(f"No image data in response. responseId={response_id}", file=sys.stderr)
raise SystemExit(1)
mime_type = image_part.get("mimeType") or image_part.get("mime_type") or "image/png"
encoded_image = image_part["data"]
if encoded_image.startswith("data:"):
header, encoded_image = encoded_image.split(",", 1)
mime_type = header[5:].split(";", 1)[0] or mime_type
extension_by_mime = {
"image/jpeg": "jpg",
"image/png": "png",
"image/webp": "webp",
"image/gif": "gif",
}
extension = extension_by_mime.get(mime_type, "bin")
output_path = f"output.{extension}"
with open(output_path, "wb") as output_file:
output_file.write(base64.b64decode(encoded_image, validate=True))
print(f"Image saved: {output_path} ({mime_type})")
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.