すべてのプロダクト
Search
ドキュメントセンター

Alibaba Cloud Model Studio:Qwen画像生成・編集3.0 APIリファレンス

最終更新日:Sep 23, 2026

Qwen画像生成・編集3.0モデルは、テキストから画像への変換(T2I)と画像から画像への変換/画像編集(I2I)の両方をサポートしています。テキストプロンプトから直接画像を生成したり、1-3枚の参照画像と編集指示を組み合わせて画像を編集したりできます。OpenAI互換プロトコルとDashScopeプロトコルの両方をサポートしています。

モデル概要

モデル

説明

出力画像の仕様

qwen-image-3.0-pro

テキストから画像への変換(T2I)と画像から画像への変換/画像編集(I2I)の両方をサポートするQwen画像生成・編集3.0モデルです。

画像解像度:

  • Text-to-image (T2I):総ピクセル数は 512*512 ~ 2048*2048 の間である必要があります。

  • Image-to-image (I2I):総ピクセル数は 512*512 ~ 2048*2048 の間である必要があります。

  • デフォルト:sizeが指定されていない場合、モデルはプロンプトに基づいて解像度を自動的に推奨します。

画像形式:PNG

qwen-image-3.0

テキストから画像への変換(T2I)と画像から画像への変換/画像編集(I2I)の両方をサポートするQwen画像生成・編集3.0標準モデルです。品質と速度のバランスが取れています。

可用性

モデル、エンドポイント URL、および API キーは同じリージョンに属している必要があります。クロスリージョン呼び出しは失敗します。

  • モデルを選択する:ターゲットリージョンでモデルが利用可能であることを確認してください。
  • URLの選択:モデルのリージョンに一致するエンドポイントURLを選択してください。HTTPおよびDashScope SDKのURLの両方がサポートされています。
  • APIキーの設定:対象リージョンのAPIキーを取得し、APIキーを環境変数として設定してください。
  • SDKのインストール:SDKでAPI呼び出しを行うには、DashScope SDKをインストールしてください。

注記本トピックのサンプルコードは シンガポール リージョンに適用されます。

重要Alibaba Cloud Model Studioは、中国(北京)およびシンガポールリージョン向けにワークスペース固有のドメインをリリースしました。新しい専用ドメインは、推論リクエストに対して優れたパフォーマンスと高い安定性を提供します。新しいドメインへの移行を推奨します。

  • 中国(北京):https://dashscope.aliyuncs.com から https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com へ
  • シンガポール:https://dashscope-intl.aliyuncs.com から https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com へ

{WorkspaceId}はワークスペースIDであり、Alibaba Cloud Model StudioコンソールのWorkspace Detailsページで確認できます。既存のドメインは引き続き完全に機能します。

アクセス方法

Qwen画像生成・編集3.0は、同一のモデル機能を持つ3つのアクセス方法を提供しています。アプリケーションに適したものを選択してください。

アクセス方法

使用場面

OpenAI互換

すでにOpenAI ImagesプロトコルまたはOpenAI SDK上に構築されたアプリケーション向けです。base_urlとmodelを切り替えることで移行できます。同期呼び出しのみです。画像入力はパブリックURLとBase64の両方をサポートします。

DashScope同期

推奨されます。パブリック URL と Base64 画像入力の両方を含む、完全な機能カバレッジを提供します。

DashScope非同期

バッチ生成、または接続を開いたままにwantない場合に使用します。タスクを送信し、task_idを使用して結果をポーリングします。

OpenAI 互換

アプリケーションがすでにOpenAI ImagesプロトコルまたはOpenAI SDK上に構築されている場合、リクエスト構造を変更することなく、OpenAI互換モードを通じてQwen画像生成・編集3.0を呼び出すことができます。テキストから画像(T2I)と画像から画像/画像編集(I2I)は同じエンドポイントを共有します:T2Iの場合はomit image とし、I2Iの場合は image を指定します。

注記OpenAI互換モードは同期・非ストリーミングエンドポイントです。画像編集では、/images/generations上のimage拡張フィールドを使用します。公式OpenAIの/images/editsエンドポイントで使用されるマルチパートファイルアップロード形式は使用しません。現在、以下はまだサポートされていません:非同期呼び出し、ストリーミング出力、部分画像、/images/edits、マルチパート、およびマスク。response_format=b64_jsonを渡してもエラーにはなりませんが、無視され、レスポンスには引き続き画像URLが含まれます。非同期呼び出しを行うには、DashScope非同期を使用してください。

URL

Singapore

HTTP エンドポイント:POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/images/generations

SDK 呼び出し用の base_url:https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1

米国(バージニア)

HTTP エンドポイント:POST https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/compatible-mode/v1/images/generations

SDK 呼び出し用の base_url:https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/compatible-mode/v1

中国(北京)

HTTP エンドポイント:POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/images/generations

SDK 呼び出し用の base_url:https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1

China (Hong Kong)

HTTP エンドポイント:POST https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1/images/generations

SDK 呼び出し用の base_url:https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1

Germany (Frankfurt)

HTTP エンドポイント:POST https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/compatible-mode/v1/images/generations

SDK 呼び出し用の base_url:https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/compatible-mode/v1

Japan (Tokyo)

HTTP エンドポイント:POST https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/compatible-mode/v1/images/generations

SDK 呼び出し用の base_url:https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/compatible-mode/v1

{WorkspaceId}を実際のワークスペースIDに置き換えます。

リクエストパラメーター

ヘッダー

Content-Type string (必須)

リクエストのコンテンツタイプです。application/jsonである必要があります。

Authorization string (必須)

Model Studio APIキーを使用してリクエストを認証します。例:Bearer sk-xxxx。

リクエストボディ

DashScopeプロトコルとは異なり、OpenAI互換モードではすべてのパラメータがリクエストボディのトップレベルに配置されます。inputやparametersのネストはありません。

model string (必須)

モデル名です。利用可能な値:qwen-image-3.0-pro および qwen-image-3.0。

prompt string (必須)

生成または編集wantたい画像の内容、スタイル、構図を記述するポジティブプロンプトです。中国語と英語の両方がサポートされています。推奨最大値:4,500トークン。空文字列にすることはできません。

image string または array(任意)

入力画像のURLまたはBase64エンコードデータです。テキストから画像への変換(T2I)の場合はこのパラメータを省略してください。画像から画像への変換(I2I)の場合は指定する必要があり、1-3枚の画像がサポートされています。単一画像の場合は文字列を渡し、複数画像の場合は文字列の配列を渡してください。複数の画像が提供される場合、順序は配列のシーケンスによって定義されます。

注意:null および空の配列は 400 エラーで拒否されます。

画像要件:
  • 画像形式:JPG、JPEG、PNG、BMP、TIFF、WEBP、および GIF。
  • 画像解像度:最適な結果を得るには、幅と高さを 384 ~ 2048 ピクセルの間に設定することを推奨します。
  • 画像サイズ:最大 10 MB。
サポートされている入力形式
  1. パブリック URL:HTTP および HTTPS プロトコルがサポートされています。
  2. Base64 エンコーディング:形式は data:{MIME_type};base64,{base64_data} です。

n integer(オプション)

出力画像の数です。値の範囲:1~6。デフォルト:1。整数である必要があります。"1"のような文字列値を指定すると、400エラーが返されます。

size string(オプション)

出力画像の解像度をwidthxheight形式で指定します(例:"1024x1024")。autoを渡すこともできます。指定しない場合、モデルはプロンプトに基づいて解像度を自動的に推奨します。

警告OpenAIプロトコルでは、DashScopeプロトコルで使用されるアスタリスク*(1024*1024)ではなく、文字 x xを区切り文字として使用します(1024x1024)。DashScopeから移行する際は、この値を更新してください。

  • Text-to-image (T2I):ピクセル面積は 512x512 ~ 2048x2048 です。アスペクト比:1:8 ~ 8:1。
  • Image-to-image (I2I):ピクセル面積は 512x512 ~ 2048x2048 です。アスペクト比:1:8 ~ 8:1。

negative_prompt string(任意)

画像にwantとしない内容を記述するネガティブプロンプトです。

seed integer(オプション)

ランダムシードです。値の範囲:[0, 2147483647]。省略した場合、サービスはランダムシードを生成します。再現性のある結果を得るには、固定シードを使用してください。

prompt_extend boolean(任意)

インテリジェントプロンプト書き換えを有効にするかどうかです。デフォルト:true(推奨)。有効にすると、モデルはprompt_extend_modeで指定された方法を使用してポジティブプロンプトを最適化し、単純な説明の場合に結果を大幅に改善します。

prompt_extend_mode string(任意)

プロンプトの書き換え方法です。デフォルト:direct。オプション:

  • direct:Direct Prompt Enhancement (DPE)、ほとんどのシナリオに適しています。T2I と I2I の両方でサポートされています。
  • agent:エージェントプロンプト強化(APE)により、より洗練された書き換えを提供します。テキストから画像への変換(T2I)のみをサポートします。画像から画像への変換(I2I)でagentを渡すと、400エラーが返されます。

enable_thinking boolean(任意)

思考モードを有効にします。デフォルトはtrueです。これによりモデルの推論能力が強化され画質が向上しますが、生成時間は長くなります。prompt_extend=trueが必要です。ダイレクトT2I、ダイレクトI2I、およびエージェントT2Iでサポートされています。I2Iエージェントではサポートされていません。

watermark boolean(オプション)

ウォーターマークを追加するかどうか。デフォルト:false。

注記image、negative_prompt、seed、prompt_extend、prompt_extend_mode、enable_thinking、およびwatermarkはModel Studio拡張フィールドであり、公式のOpenAIパラメータではありません。生のHTTPリクエストの場合、これらをリクエストボディのトップレベルに配置してください。OpenAI SDKを使用する場合は、extra_bodyを通じて渡してください。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/images/generations' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--data '{
    "model": "qwen-image-3.0-pro",
    "prompt": "A vertical outdoor portrait photograph with a warm afternoon street atmosphere. Deep green vines and small orange flowers cascade from building eaves across the upper area. A dark blue sign reads '\''Il Messaggero'\'' in white Gothic lettering, partially obscured by foliage. Below, a newsstand displays newspapers behind black metal-framed glass, blurred by shallow depth of field. Strong backlight streams from the street'\''s end. Center-right, a young woman in a black spaghetti-strap backless dress looks back at the camera with a warm smile. Her long, thick wavy black hair is outlined by golden rim light. She has fair skin, bright eyes, soft coral-red lips, and holds a large bouquet of orange, apricot, pink and peach roses contrasting with her black dress. The sunlit city street stretches into the blurred background. Warm film-like tones with fine grain, soft contrast and pronounced backlit edge glow create a romantic, bright, urban strolling atmosphere.",
    "size": "1024x1024",
    "n": 1,
    "prompt_extend": true
}'
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/images/generations' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--data '{
    "model": "qwen-image-3.0-pro",
    "prompt": "Generate a sophisticated urban-style female portrait. Perfectly preserve the facial features and smooth black long hair of the young woman in the input image. She changes from her beige knit top into an elegant urban professional outfit: a champagne silk blouse with a well-tailored dark grey casual blazer and matching high-waisted wide-leg trousers. The scene is in a modern minimalist upscale coffee shop with floor-to-ceiling windows showing a bustling city view. Dark wood tables and leather chairs furnish the interior, with a silver laptop, documents, and a steaming Americano on the table. She sits relaxed, leaning slightly back with one arm on the armrest and the other holding a coffee cup, gazing at the camera with calm, slightly languid eyes and an elegant smile. Polished formal makeup with clean base, defined brows, and mauve lipstick. Soft afternoon light enters from the side through the windows, creating delicate light transitions on her face and clothing. Natural bokeh background in earth tones, greys and warm whites, creating a serene, sophisticated urban office atmosphere.",
    "image": "https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/yBRq1ZPYEaXdyOdv/img/33a80a19-7ac7-4c64-b0fa-7d685b7046a0.png",
    "size": "1024x1024",
    "n": 1,
    "prompt_extend": true
}'

レスポンスパラメーター

created integer

レスポンスが作成された際の Unix タイムスタンプ(秒単位)です。

data array

生成結果のリストです。n が 1 より大きい場合、配列には複数の要素が含まれます。

プロパティ

url string

PNG形式で生成された画像のURLです。リンクの有効期間は24時間です。画像を速やかにダウンロードして保存してください。

usage object

この呼び出しのリソース使用量です。成功時のみ返されます。これらは画像の入出力メータリングフィールドであり、トークン使用量ではありません。

プロパティ

output_width integer

最終出力画像の幅(ピクセル単位)です。

output_height integer

最終出力画像の高さ(ピクセル単位)です。

input_image_count integer

リクエスト内の入力画像の数です。テキストから画像への変換(T2I)の場合は0を返し、画像から画像への変換(I2I)の場合は実際の数を返します。

input_image_type string

入力画像の課金ティアです。出力解像度のピクセル面積によって決定されます:面積が2,250,000以下の場合はqima_input_1k、面積が2,250,000より大きい場合はqima_input_2kとなります。

output_image_count integer

返される出力画像の実際の数です。

output_image_type string

出力画像の課金ティアです。出力解像度のピクセル面積によって決定されます:面積が2,250,000以下の場合はqima_output_1k、面積が2,250,000より大きい場合はqima_output_2kとなります。

error object

エラーの詳細です。失敗したリクエストに対してのみ返されます。

プロパティ

message string

詳細なエラーメッセージ。

type string

エラータイプ(例:invalid_request_error)。

param string

エラーの原因となったパラメーター名、またはエラーが特定のパラメーターに起因しない場合は null です。

code string

エラーコードです。エラーコードを参照してください。

注記DashScopeプロトコルとは異なり、OpenAI互換モードではレスポンスボディにrequest_idが返されません request_id。一意のリクエスト識別子はx-request-id HTTPレスポンスヘッダーに返されます。OpenAI Python SDKでは、成功時はresponse._request_idを、失敗時はAPIStatusError.request_idを読み取ってください。問題を報告する際は、この識別子を含めてください。

Success

画像 URL は 24 時間のみ保持され、その後自動的に削除されます。生成された画像は速やかに保存してください。

{
    "created": 1788339600,
    "data": [
        {
            "url": "https://dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com/xxx.png?Expires=xxx"
        }
    ],
    "usage": {
        "output_height": 1024,
        "output_width": 1024,
        "input_image_count": 0,
        "input_image_type": "qima_input_1k",
        "output_image_count": 1,
        "output_image_type": "qima_output_1k"
    }
}

エラー

リクエストが失敗した場合、レスポンスにはerrorオブジェクトが含まれ、そのcodeおよびmessageフィールドに原因が示されます。トラブルシューティングについては、エラーコードを参照してください。

{
    "error": {
        "message": "Field 'prompt' is required",
        "type": "invalid_request_error",
        "param": null,
        "code": "InvalidParameter"
    }
}

SDK

まずOpenAI Python SDKをインストールまたはアップグレードしてください。

pip install -U openai

重要画像生成には時間がかかる場合があります。明示的で十分なクライアントタイムアウトを設定してください。複数画像出力(nが大きい場合)や同時リクエストの場合は、クライアントが早期に切断されないよう600秒から開始してください。

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
    timeout=600.0,
)

response = client.images.generate(
    model="qwen-image-3.0-pro",
    prompt="A vertical outdoor portrait photograph with a warm afternoon street atmosphere. Deep green vines and small orange flowers cascade from building eaves across the upper area. A dark blue sign reads 'Il Messaggero' in white Gothic lettering, partially obscured by foliage. Below, a newsstand displays newspapers behind black metal-framed glass, blurred by shallow depth of field. Strong backlight streams from the street's end. Center-right, a young woman in a black spaghetti-strap backless dress looks back at the camera with a warm smile. Her long, thick wavy black hair is outlined by golden rim light. She has fair skin, bright eyes, soft coral-red lips, and holds a large bouquet of orange, apricot, pink and peach roses contrasting with her black dress. The sunlit city street stretches into the blurred background. Warm film-like tones with fine grain, soft contrast and pronounced backlit edge glow create a romantic, bright, urban strolling atmosphere.",
    size="1024x1024",
    n=1,
    # All parameters above are official OpenAI parameters. Extension fields such as
    # image and prompt_extend go through extra_body. See the I2I example.
)

for item in response.data:
    print(item.url)
print(f"request_id: {response._request_id}")
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
    timeout=600.0,
)

response = client.images.generate(
    model="qwen-image-3.0-pro",
    prompt="Generate a sophisticated urban-style female portrait. Perfectly preserve the facial features and smooth black long hair of the young woman in the input image. Change her outfit to an elegant urban professional look. Set the scene in a modern minimalist upscale coffee shop.",
    size="1024x1024",
    n=1,
    extra_body={
        # A single image can also be passed as a plain string. Base64 is also accepted:
        # data:{MIME_type};base64,{base64_data}
        "image": [
            "https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/yBRq1ZPYEaXdyOdv/img/33a80a19-7ac7-4c64-b0fa-7d685b7046a0.png"
        ],
        "prompt_extend": True,
    },
)

for item in response.data:
    print(item.url)
print(f"request_id: {response._request_id}")
import os
from openai import OpenAI, APIStatusError

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
    timeout=600.0,
)

try:
    response = client.images.generate(
        model="qwen-image-3.0-pro",
        prompt="A vertical outdoor portrait photograph with a warm afternoon street atmosphere.",
    )
    print(response.data[0].url)
except APIStatusError as exc:
    print(f"status_code: {exc.status_code}")
    print(f"request_id: {exc.request_id}")
    print(exc)

DashScope 同期 API(推奨)

HTTP

Singapore

POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation

米国(バージニア)

POST https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation

中国(北京)

POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation

China (Hong Kong)

POST https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation

Germany (Frankfurt)

POST https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation

Japan (Tokyo)

POST https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation

{WorkspaceId}を実際のワークスペースIDに置き換えます。

リクエストパラメーター

ヘッダー

Content-Type string (必須)

リクエストのコンテンツタイプです。application/jsonである必要があります。

Authorization string (必須)

Model Studio APIキーを使用してリクエストを認証します。例:Bearer sk-xxxx。

リクエストボディ

model string (必須)

モデル名です。利用可能な値:qwen-image-3.0-pro および qwen-image-3.0。

input object (必須)

入力パラメーターオブジェクトで、以下のフィールドが含まれます。

プロパティ

messages array (必須)

リクエストコンテンツ配列です。単一ターンの会話のみがサポートされているため、配列にはroleおよびcontentプロパティを持つ正確に1つのオブジェクトを含める必要があります。

プロパティ

rolestring (必須)

メッセージ送信者のロールです。user に設定する必要があります。

contentarray (必須)

メッセージ内容の配列で、ユースケースに応じて異なる組み合わせがあります。

  • Text-to-image (T2I):{"text": "..."} オブジェクトのみを1つ含みます。
  • Image-to-image (I2I):1-3 個の {"image": "..."} オブジェクトと 1 個の {"text": "..."} オブジェクトを含みます。

プロパティ

image string (I2I に必須)

入力画像のURLまたはBase64エンコードデータです。I2Iシナリオでは、1-3枚の画像がサポートされています。複数の画像が提供される場合、順序は配列のシーケンスによって定義されます。

画像要件:
  • 画像形式:JPG、JPEG、PNG、BMP、TIFF、WEBP、および GIF。
  • 画像解像度:最適な結果を得るには、幅と高さを 384 ~ 2048 ピクセルの間に設定することを推奨します。
  • 画像サイズ:最大 10 MB。
サポートされている入力形式
  1. パブリック URL:HTTP および HTTPS プロトコルがサポートされています。
  2. Base64 エンコーディング:形式は data:{MIME_type};base64,{base64_data} です。

textstring(必須)

生成または編集wantたい画像の内容、スタイル、構図を記述するポジティブプロンプトです。中国語と英語の両方がサポートされています。推奨最大値:4,500トークン。

注意:許可されるtextオブジェクトは1つだけです。これを省略したり、複数のtextオブジェクトを指定したりすると、エラーが発生します。

parameters object(オプション)

画像生成を制御するための追加パラメーターです。

プロパティ

prompt_extend boolean(任意)

インテリジェントプロンプト書き換えを有効にするかどうかです。デフォルト:true(推奨)。有効にすると、モデルはprompt_extend_modeで指定された方法を使用してポジティブプロンプトを最適化し、単純な説明の場合に結果を大幅に改善します。

prompt_extend_mode string(任意)

プロンプトの書き換え方法です。デフォルト:direct。オプション:

  • direct:Direct Prompt Enhancement (DPE)、ほとんどのシナリオに適しています。T2I と I2I の両方でサポートされています。
  • agent:エージェントプロンプト強化(APE)により、より洗練された書き換えを提供します。テキストから画像への変換(T2I)のみをサポートします。画像から画像への変換(I2I)でagentを渡すと、400エラーが返されます。

enable_thinking boolean(任意)

思考モードを有効にします。デフォルトはtrueです。これによりモデルの推論能力が強化され画質が向上しますが、生成時間は長くなります。prompt_extend=trueが必要です。ダイレクトT2I、ダイレクトI2I、およびエージェントT2Iでサポートされています。I2Iエージェントではサポートされていません。

n integer(オプション)

出力画像の数です。値の範囲:1 ~ 6。デフォルト:1。

size string(オプション)

出力画像の解像度をwidth*height形式で指定します(例:"1024*1024")。指定しない場合、モデルはプロンプトに基づいて解像度を自動的に推奨します。

  • Text-to-image (T2I):ピクセル面積は 512512 ~ 20482048 です。アスペクト比:1:8 ~ 8:1。
  • Image-to-image (I2I):ピクセル面積は 512512 ~ 20482048 です。アスペクト比:1:8 ~ 8:1。

negative_prompt string(任意)

画像にwantとしない内容を記述するネガティブプロンプトです。

seed integer(オプション)

ランダムシードです。値の範囲:[0, 2147483647]。省略した場合、サービスはランダムシードを生成します。再現性のある結果を得るには、固定シードを使用してください。

watermark boolean(オプション)

ウォーターマークを追加するかどうか。デフォルト:false。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--data '{
    "model": "qwen-image-3.0-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "text": "A vertical outdoor portrait photograph with a warm afternoon street atmosphere. Deep green vines and small orange flowers cascade from building eaves across the upper area. A dark blue sign reads '\''Il Messaggero'\'' in white Gothic lettering, partially obscured by foliage. Below, a newsstand displays newspapers behind black metal-framed glass, blurred by shallow depth of field. Strong backlight streams from the street'\''s end. Center-right, a young woman in a black spaghetti-strap backless dress looks back at the camera with a warm smile. Her long, thick wavy black hair is outlined by golden rim light. She has fair skin, bright eyes, soft coral-red lips, and holds a large bouquet of orange, apricot, pink and peach roses contrasting with her black dress. The sunlit city street stretches into the blurred background. Warm film-like tones with fine grain, soft contrast and pronounced backlit edge glow create a romantic, bright, urban strolling atmosphere."
                    }
                ]
            }
        ]
    },
    "parameters": {
        "prompt_extend": true
    }
}'
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--data '{
    "model": "qwen-image-3.0-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "image": "https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/yBRq1ZPYEaXdyOdv/img/33a80a19-7ac7-4c64-b0fa-7d685b7046a0.png"
                    },
                    {
                        "text": "Generate a sophisticated urban-style female portrait. Perfectly preserve the facial features and smooth black long hair of the young woman in the input image. She changes from her beige knit top into an elegant urban professional outfit: a champagne silk blouse with a well-tailored dark grey casual blazer and matching high-waisted wide-leg trousers. The scene is in a modern minimalist upscale coffee shop with floor-to-ceiling windows showing a bustling city view. Dark wood tables and leather chairs furnish the interior, with a silver laptop, documents, and a steaming Americano on the table. She sits relaxed, leaning slightly back with one arm on the armrest and the other holding a coffee cup, gazing at the camera with calm, slightly languid eyes and an elegant smile. Polished formal makeup with clean base, defined brows, and mauve lipstick. Soft afternoon light enters from the side through the windows, creating delicate light transitions on her face and clothing. Natural bokeh background in earth tones, greys and warm whites, creating a serene, sophisticated urban office atmosphere."
                    }
                ]
            }
        ]
    },
    "parameters": {
        "prompt_extend": true
    }
}'

レスポンスパラメーター

output object

モデルの生成結果が含まれます。

プロパティ

rewrite_status string

プロンプト書き換えのステータスです。値は、リクエストで書き換えが有効にされたかどうか、および書き換えの結果によって異なります。

choices array

結果オプションのリストです。

プロパティ

finish_reason string

タスクが停止した理由です。タスクが正常に完了した場合、値は stop になります。

message object

モデルから返されるメッセージです。

プロパティ

rolestring

メッセージのロールです。assistant に固定されています。

contentarray

生成された画像情報を含むメッセージ内容です。

プロパティ

image string

PNG形式で生成された画像のURLです。リンクの有効期間は24時間です。画像を速やかにダウンロードして保存してください。

usage object

この呼び出しのリソース使用量です。成功時のみ返されます。これらは画像の入出力メータリングフィールドであり、トークン使用量ではありません。

プロパティ

output_width integer

最終出力画像の幅(ピクセル単位)です。

output_height integer

最終出力画像の高さ(ピクセル単位)です。

input_image_count integer

リクエスト内の入力画像の数です。テキストから画像への変換(T2I)の場合は0を返し、画像から画像への変換(I2I)の場合は実際の数を返します。

input_image_type string

入力画像の課金ティアです。出力解像度のピクセル面積によって決定されます:面積が2,250,000以下の場合はqima_input_1k、面積が2,250,000より大きい場合はqima_input_2kとなります。

output_image_count integer

返される出力画像の実際の数です。

output_image_type string

出力画像の課金ティアです。出力解像度のピクセル面積によって決定されます:面積が2,250,000以下の場合はqima_output_1k、面積が2,250,000より大きい場合はqima_output_2kとなります。

request_id string

トレースおよびトラブルシューティングのための一意のリクエスト識別子です。

code string

エラーコードです。失敗したリクエストに対してのみ返されます。エラーコードをご確認ください。

message string

詳細なエラーメッセージです。失敗したリクエストに対してのみ返されます。エラーコードをご確認ください。

Success

タスクデータ(タスクステータスおよび画像URL)は24時間のみ保持され、その後自動的に削除されます。生成された画像は速やかに保存してください。

{
    "output": {
        "choices": [
            {
                "finish_reason": "stop",
                "message": {
                    "content": [
                        {
                            "image": "https://dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com/xxx.png?Expires=xxx"
                        }
                    ],
                    "role": "assistant"
                }
            }
        ]
    },
    "usage": {
        "output_height": 1024,
        "output_width": 1024,
        "input_image_count": 1,
        "input_image_type": "qima_input_1k",
        "output_image_count": 1,
        "output_image_type": "qima_output_1k"
    },
    "request_id": "571ae02f-5c9d-436c-83c2-f221e6df0xxx"
}

エラー

タスクが失敗した場合、レスポンスにはエラーコードとメッセージが含まれます。トラブルシューティングについては、エラーコードを参照してください。

{
    "request_id": "31f808fd-8eef-9004-xxxxx",
    "code": "InvalidApiKey",
    "message": "Invalid API-key provided."
}

SDK

以下の例では、PythonおよびJava SDKを使用して画像から画像への変換/画像編集(I2I)を行うAPIの呼び出し方法を示します。

import os
import base64
import mimetypes
import dashscope
from dashscope import MultiModalConversation

dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'

def encode_file(file_path):
    mime_type, _ = mimetypes.guess_type(file_path)
    if not mime_type or not mime_type.startswith("image/"):
        raise ValueError("Unsupported or unrecognized image format")
    with open(file_path, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
    return f"data:{mime_type};base64,{encoded_string}"

# [Method 1] Use a public image URL
image_url = "https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/yBRq1ZPYEaXdyOdv/img/33a80a19-7ac7-4c64-b0fa-7d685b7046a0.png"

# [Method 2] Use a Base64-encoded image
# image_url = encode_file("./your_image.png")

response = MultiModalConversation.call(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    model="qwen-image-3.0-pro",
    messages=[{
        "role": "user",
        "content": [
            {"image": image_url},
            {"text": "Generate a sophisticated urban-style female portrait. Perfectly preserve the facial features and smooth black long hair of the young woman in the input image. Change her outfit to an elegant urban professional look. Set the scene in a modern minimalist upscale coffee shop."}
        ]
    }],
    prompt_extend=True
)

print(response)
if response.status_code == 200:
    url = response.output.choices[0].message.content[0]["image"]
    print(f"Generated image URL: {url}")
else:
    print(f"Error: {response.code} - {response.message}")
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversation;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationParam;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationResult;
import com.alibaba.dashscope.common.MultiModalMessage;
import com.alibaba.dashscope.common.Role;
import com.alibaba.dashscope.utils.Constants;

public class ImageEditExample {
    public static void main(String[] args) {
        Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";

        // [Method 1] Use a public image URL
        String imageUrl = "https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/yBRq1ZPYEaXdyOdv/img/33a80a19-7ac7-4c64-b0fa-7d685b7046a0.png";

        // [Method 2] Use a Base64-encoded image
        // String imageUrl = encodeFile("/path/to/your/image.png");

        MultiModalConversation conv = new MultiModalConversation();
        MultiModalMessage userMessage = MultiModalMessage.builder()
            .role(Role.USER.getValue())
            .content(Arrays.asList(
                Collections.singletonMap("image", imageUrl),
                Collections.singletonMap("text", "Generate a sophisticated urban-style female portrait. Perfectly preserve the facial features and smooth black long hair of the young woman in the input image. Change her outfit to an elegant urban professional look. Set the scene in a modern minimalist upscale coffee shop.")
            ))
            .build();
        MultiModalConversationParam param = MultiModalConversationParam.builder()
            .apiKey(System.getenv("DASHSCOPE_API_KEY"))
            .model("qwen-image-3.0-pro")
            .messages(Arrays.asList(userMessage))
            .parameter("prompt_extend", true)
            .build();
        try {
            MultiModalConversationResult result = conv.call(param);
            System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static String encodeFile(String filePath) {
        Path path = Paths.get(filePath);
        if (!Files.exists(path)) {
            throw new IllegalArgumentException("File does not exist: " + filePath);
        }
        String mimeType = null;
        try {
            mimeType = Files.probeContentType(path);
        } catch (IOException e) {
            throw new IllegalArgumentException("Cannot detect file type: " + filePath);
        }
        if (mimeType == null || !mimeType.startsWith("image/")) {
            throw new IllegalArgumentException("Unsupported or unrecognized image format");
        }
        byte[] fileBytes = null;
        try {
            fileBytes = Files.readAllBytes(path);
        } catch (IOException e) {
            throw new IllegalArgumentException("Cannot read file content: " + filePath);
        }
        String encodedString = Base64.getEncoder().encodeToString(fileBytes);
        return "data:" + mimeType + ";base64," + encodedString;
    }
}

DashScope 非同期 API

上記の同期呼び出しに加えて、Qwen画像生成・編集3.0は非同期呼び出しもサポートしています。非同期APIは同期APIと同じリクエストパラメータ構造を共有します。X-DashScope-Async: enableヘッダーを追加するだけで済みます。サービスがリクエストを受理した後、タスクID(task_id)を返しますので、それを使用して最終結果をクエリAPIにポーリングします。

重要非同期APIのエンドポイントは同期APIとは異なります。同期エンドポイントの代わりに、このセクションのエンドポイントを使用してください。

HTTP

非同期呼び出しでは、2段階のワークフローを使用します。

  1. タスクを作成してタスクIDを取得する:タスク作成のリクエストを送信します。レスポンスにはタスクID(task_id)が含まれます。
  2. タスクIDを使用して結果をポーリングする:task_idを使用して、タスクが完了し画像URLが返されるまでタスクステータスをポーリングします。

ステップ1:タスクを作成してタスクIDを取得する

Singapore

POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation

米国(バージニア)

POST https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation

中国(北京)

POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation

China (Hong Kong)

POST https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation

Germany (Frankfurt)

POST https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation

Japan (Tokyo)

POST https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation

リクエストパラメーター
ヘッダー

Content-Type string (必須)

リクエストのコンテンツタイプです。application/jsonである必要があります。

Authorization string (必須)

Model Studio APIキーを使用してリクエストを認証します。例:Bearer sk-xxxx。

X-DashScope-Async string (必須)

非同期処理を有効にします。値はenableである必要があります。このセクションのエンドポイントは非同期リクエストのみを受け付け、同期呼び出しはサポートしていません。

重要このリクエストヘッダーがない場合、「current user api does not support synchronous calls」というエラーが返されます。

リクエストボディ

model string (必須)

モデル名です。利用可能な値:qwen-image-3.0-pro および qwen-image-3.0。

input object (必須)

入力パラメーターオブジェクトで、以下のフィールドが含まれます。

プロパティ

messages array (必須)

リクエストコンテンツ配列です。単一ターンの会話のみがサポートされているため、配列にはroleおよびcontentプロパティを持つ正確に1つのオブジェクトを含める必要があります。

プロパティ

rolestring (必須)

メッセージ送信者のロールです。user に設定する必要があります。

contentarray (必須)

メッセージ内容の配列で、ユースケースに応じて異なる組み合わせがあります。

  • Text-to-image (T2I):{"text": "..."} オブジェクトのみを1つ含みます。
  • Image-to-image (I2I):1-3 個の {"image": "..."} オブジェクトと 1 個の {"text": "..."} オブジェクトを含みます。

プロパティ

image string (I2I に必須)

入力画像のURLまたはBase64エンコードデータです。I2Iシナリオでは、1-3枚の画像がサポートされています。複数の画像が提供される場合、順序は配列のシーケンスによって定義されます。

画像要件:
  • 画像形式:JPG、JPEG、PNG、BMP、TIFF、WEBP、および GIF。
  • 画像解像度:最適な結果を得るには、幅と高さを 384 ~ 2048 ピクセルの間に設定することを推奨します。
  • 画像サイズ:最大 10 MB。
サポートされている入力形式
  1. パブリック URL:HTTP および HTTPS プロトコルがサポートされています。
  2. Base64 エンコーディング:形式は data:{MIME_type};base64,{base64_data} です。

textstring(必須)

生成または編集wantたい画像の内容、スタイル、構図を記述するポジティブプロンプトです。中国語と英語の両方がサポートされています。推奨最大値:4,500トークン。

注意:許可されるtextオブジェクトは1つだけです。これを省略したり、複数のtextオブジェクトを指定したりすると、エラーが発生します。

parameters object(オプション)

画像生成を制御するための追加パラメーターです。

プロパティ

prompt_extend boolean(任意)

インテリジェントプロンプト書き換えを有効にするかどうかです。デフォルト:true(推奨)。有効にすると、モデルはprompt_extend_modeで指定された方法を使用してポジティブプロンプトを最適化し、単純な説明の場合に結果を大幅に改善します。

prompt_extend_mode string(任意)

プロンプトの書き換え方法です。デフォルト:direct。オプション:

  • direct:Direct Prompt Enhancement (DPE)、ほとんどのシナリオに適しています。T2I と I2I の両方でサポートされています。
  • agent:エージェントプロンプト強化(APE)により、より洗練された書き換えを提供します。テキストから画像への変換(T2I)のみをサポートします。画像から画像への変換(I2I)でagentを渡すと、400エラーが返されます。

enable_thinking boolean(任意)

思考モードを有効にします。デフォルトはtrueです。これによりモデルの推論能力が強化され画質が向上しますが、生成時間は長くなります。prompt_extend=trueが必要です。ダイレクトT2I、ダイレクトI2I、およびエージェントT2Iでサポートされています。I2Iエージェントではサポートされていません。

n integer(オプション)

出力画像の数です。値の範囲:1 ~ 6。デフォルト:1。

size string(オプション)

出力画像の解像度をwidth*height形式で指定します(例:"1024*1024")。指定しない場合、モデルはプロンプトに基づいて解像度を自動的に推奨します。

  • Text-to-image (T2I):ピクセル面積は 512512 ~ 20482048 です。アスペクト比:1:8 ~ 8:1。
  • Image-to-image (I2I):ピクセル面積は 512512 ~ 20482048 です。アスペクト比:1:8 ~ 8:1。

negative_prompt string(任意)

画像にwantとしない内容を記述するネガティブプロンプトです。

seed integer(オプション)

ランダムシードです。値の範囲:[0, 2147483647]。省略した場合、サービスはランダムシードを生成します。再現性のある結果を得るには、固定シードを使用してください。

watermark boolean(オプション)

ウォーターマークを追加するかどうか。デフォルト:false。

curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'X-DashScope-Async: enable' \
--data '{
    "model": "qwen-image-3.0-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "text": "A vertical outdoor portrait photograph with a warm afternoon street atmosphere. Deep green vines and small orange flowers cascade from building eaves across the upper area. A dark blue sign reads '\''Il Messaggero'\'' in white Gothic lettering, partially obscured by foliage. Below, a newsstand displays newspapers behind black metal-framed glass, blurred by shallow depth of field. Strong backlight streams from the street'\''s end. Center-right, a young woman in a black spaghetti-strap backless dress looks back at the camera with a warm smile. Her long, thick wavy black hair is outlined by golden rim light. She has fair skin, bright eyes, soft coral-red lips, and holds a large bouquet of orange, apricot, pink and peach roses contrasting with her black dress. The sunlit city street stretches into the blurred background. Warm film-like tones with fine grain, soft contrast and pronounced backlit edge glow create a romantic, bright, urban strolling atmosphere."
                    }
                ]
            }
        ]
    },
    "parameters": {
        "prompt_extend": true
    }
}'
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'X-DashScope-Async: enable' \
--data '{
    "model": "qwen-image-3.0-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "image": "https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/yBRq1ZPYEaXdyOdv/img/33a80a19-7ac7-4c64-b0fa-7d685b7046a0.png"
                    },
                    {
                        "text": "Generate a sophisticated urban-style female portrait. Perfectly preserve the facial features and smooth black long hair of the young woman in the input image. She changes from her beige knit top into an elegant urban professional outfit: a champagne silk blouse with a well-tailored dark grey casual blazer and matching high-waisted wide-leg trousers. The scene is in a modern minimalist upscale coffee shop with floor-to-ceiling windows showing a bustling city view. Dark wood tables and leather chairs furnish the interior, with a silver laptop, documents, and a steaming Americano on the table. She sits relaxed, leaning slightly back with one arm on the armrest and the other holding a coffee cup, gazing at the camera with calm, slightly languid eyes and an elegant smile. Polished formal makeup with clean base, defined brows, and mauve lipstick. Soft afternoon light enters from the side through the windows, creating delicate light transitions on her face and clothing. Natural bokeh background in earth tones, greys and warm whites, creating a serene, sophisticated urban office atmosphere."
                    }
                ]
            }
        ]
    },
    "parameters": {
        "prompt_extend": true
    }
}'
レスポンスパラメーター

output object

タスクの受付情報です。

プロパティ

task_id string

非同期タスク ID で、タスクのステータスと結果を照会するために使用されます。必ず保存してください。

task_status string

タスクステータスです。通常、タスク送信時はPENDINGとなり、これはタスクが受理されたことのみを示し、画像が生成されたことを示すものではありません。

request_id string

トレースおよびトラブルシューティングのための一意のリクエスト識別子です。

code string

エラーコードです。失敗したリクエストに対してのみ返されます。エラーコードをご確認ください。

成功レスポンス

タスクのステータスと結果を照会するには、task_idを保存してください。

{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

エラーレスポンス

タスクの作成に失敗しました。エラーコードをご確認ください。

{
    "code": "InvalidApiKey",
    "message": "Invalid API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}

ステップ2:タスクIDを使用して結果をポーリングする

Singapore

GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}

米国(バージニア)

GET https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/api/v1/tasks/{task_id}

中国(北京)

GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}

China (Hong Kong)

GET https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/api/v1/tasks/{task_id}

Germany (Frankfurt)

GET https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1/tasks/{task_id}

Japan (Tokyo)

GET https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}

タスクを作成したときと同じリージョン、ワークスペース、およびAPIキーを使用する必要があります。クロスリージョンまたはクロスワークスペースのクエリはサポートされていません。

リクエストパラメーター
ヘッダー

Authorization string (必須)

Model Studio APIキーを使用してリクエストを認証します。例:Bearer sk-xxxx。

URL パスパラメーター

task_id string (必須)

タスクのID。

タスク結果のクエリ

{task_id}を、前のAPI呼び出しで返されたtask_id値に置き換えます。task_idは24時間有効です。{WorkspaceId}を実際のワークスペースIDに置き換えてください。

curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"
レスポンスパラメーター

output object

タスクの出力情報です。

プロパティ

task_id string

タスク ID です。24 時間有効です。

task_status string

タスクのステータスです。

列挙値

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN:タスクが存在しないか、そのステータスが不明です。
ポーリング中のステータス遷移:
  • PENDING → RUNNING → SUCCEEDED または FAILED。
  • 初期のクエリステータスは通常 PENDING または RUNNING です。
  • ステータスが SUCCEEDED に変わると、レスポンスに生成された画像の URL が含まれます。
  • ステータスが FAILED の場合は、エラーメッセージを確認してタスクを再試行してください。

submit_time string

タスクが送信された時刻です。時刻は UTC+8 で、形式は YYYY-MM-DD HH:mm:ss.SSS です。

scheduled_time string

タスクが実行された時刻です。時刻は UTC+8 で、形式は YYYY-MM-DD HH:mm:ss.SSS です。

end_time string

タスクが完了した時刻です。時刻は UTC+8 で、形式は YYYY-MM-DD HH:mm:ss.SSS です。

rewrite_status string

プロンプト書き換えのステータスです。値は、リクエストで書き換えが有効にされたかどうか、および書き換えの結果によって異なります。

choices array

結果オプションのリストです。

プロパティ

finish_reason string

タスクが停止した理由です。タスクが正常に完了した場合、値は stop になります。

message object

モデルから返されるメッセージです。

プロパティ

rolestring

メッセージのロールです。assistant に固定されています。

contentarray

生成された画像情報を含むメッセージ内容です。

プロパティ

image string

PNG形式で生成された画像のURLです。リンクの有効期間は24時間です。画像を速やかにダウンロードして保存してください。

usage object

この呼び出しのリソース使用量です。成功時のみ返されます。これらは画像の入出力メータリングフィールドであり、トークン使用量ではありません。

プロパティ

output_width integer

最終出力画像の幅(ピクセル単位)です。

output_height integer

最終出力画像の高さ(ピクセル単位)です。

input_image_count integer

リクエスト内の入力画像の数です。テキストから画像への変換(T2I)の場合は0を返し、画像から画像への変換(I2I)の場合は実際の数を返します。

input_image_type string

入力画像の課金ティアです。出力解像度のピクセル面積によって決定されます:面積が2,250,000以下の場合はqima_input_1k、面積が2,250,000より大きい場合はqima_input_2kとなります。

output_image_count integer

返される出力画像の実際の数です。

output_image_type string

出力画像の課金ティアです。出力解像度のピクセル面積によって決定されます:面積が2,250,000以下の場合はqima_output_1k、面積が2,250,000より大きい場合はqima_output_2kとなります。

request_id string

トレースおよびトラブルシューティングのための一意のリクエスト識別子です。

code string

エラーコードです。失敗したリクエストに対してのみ返されます。エラーコードをご確認ください。

message string

詳細なエラーメッセージです。失敗したリクエストに対してのみ返されます。エラーコードをご確認ください。

タスク成功

タスクデータ(タスクステータスおよび画像URL)は24時間のみ保持され、その後自動的に削除されます。生成された画像は速やかに保存してください。

{
    "output": {
        "task_id": "17d7d840-82b9-485b-a954-724d06bc88d2",
        "task_status": "SUCCEEDED",
        "submit_time": "2026-08-07 15:50:14.837",
        "scheduled_time": "2026-08-07 15:50:14.884",
        "end_time": "2026-08-07 15:50:33.607",
        "rewrite_status": "not_use",
        "choices": [
            {
                "finish_reason": "stop",
                "message": {
                    "role": "assistant",
                    "content": [
                        {
                            "image": "https://dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com/xxx.png?Expires=xxx",
                            "type": "image"
                        }
                    ]
                }
            }
        ]
    },
    "usage": {
        "output_height": 1024,
        "output_width": 1024,
        "input_image_count": 0,
        "input_image_type": "qima_input_1k",
        "output_image_count": 1,
        "output_image_type": "qima_output_1k"
    },
    "request_id": "2bd94002-5624-9129-916b-fbdde107b4ba"
}

タスク失敗

タスクが失敗した場合、task_statusはエラーコードとメッセージとともにFAILEDになります。エラーコードを参照してください。

{
    "output": {
        "task_id": "17d7d840-82b9-485b-a954-724d06bc88d2",
        "task_status": "FAILED",
        "code": "InternalError",
        "message": "An internal error has occurred."
    },
    "request_id": "31f808fd-8eef-9004-xxxxx"
}

エラーコード

モデルの呼び出しに失敗してエラーメッセージが返された場合は、解決策としてエラーコードをご確認ください。