メインコンテンツへ移動

モデルガイド

GPT Image 2 VIP

gpt-image-2-vip

正確なサイズ

OpenAI Images API を使用し、正確なサイズ、画像編集、3段階の品質設定に対応します。

OpenAI 互換ルートテキストから画像画像編集品質レベル
モデル情報
モデル ID
gpt-image-2-vip
参考価格
$0.03/ 回
出力サイズ
1K / 2K / 4K
API 形式
OpenAI Images

プロンプトプリセット

以下は 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.

UI イラスト

A polished onboarding illustration with a simple interface motif, restrained colors, crisp shapes, and generous negative space.

利用できる設定

以下は画像スタジオで現在利用できる設定です。

適した用途

  • 正確な出力サイズ
  • 目立つ文字を含む画像
  • OpenAI Images のワークフロー

利用前の確認

  • 各出力で文字と綴りを必ず確認してください。
  • 品質レベルはリクエストに影響するため、用途ごとに選んでください。
  • このページで選べる正確なサイズを使ってください。
画像編集: 対応

API クイックスタート

画像スタジオと同じリクエスト形式を使った例です。

API ページを見る
gpt-image-2-vip
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))

Studio の例

これらの画像には生成時のモデルとプロンプトが記録されていません。視覚例であり、モデルのテスト結果ではありません。

Studio の例
Studio の例
Studio の例

テスト記録

YingTu の公開テスト記録

ここには、テスト条件と生成結果を確認できる形で公開した YingTu の記録だけを掲載します。未公開の記録は表示しません。

公開テスト結果なし

商品デザインの保持

形状、比率、色、ロゴ、パッケージ上の文字に意図しない変化がないかを確認します。

公開テスト結果なし

背景の置き換え

被写体が保たれているか、輪郭が崩れていないか、指定した背景になっているかを確認します。