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

Alibaba Cloud Model Studio:OpenAI 互換 - Vision

最終更新日:Jan 31, 2026

Alibaba Cloud Model Studio の Qwen-VL モデルは、OpenAI API 仕様と互換性があります。既存の OpenAI アプリケーションを Model Studio に移行するには、次の 3 つのパラメーターを変更するだけです。

  • `base_url` パラメーターを https://dashscope-intl.aliyuncs.com/compatible-mode/v1 に更新します。

    米国 (バージニア) リージョンのモデルを使用する場合、`base_url` を https://dashscope-us.aliyuncs.com/compatible-mode/v1 に設定します。中国 (北京) リージョンのモデルを使用する場合、URL を https://dashscope.aliyuncs.com/compatible-mode/v1 に設定します。
  • `api_key` をご自身の Model Studio API キーに置き換えます。

  • `model`:次のリストからモデルを指定します。

サポートされているモデル

グローバル

  • Qwen-VL シリーズモデル:qwen3-vl-plus, qwen3-vl-plus-2025-09-23, qwen3-vl-flash, qwen3-vl-flash-2025-10-15, qwen3-vl-235b-a22b-thinking, qwen3-vl-235b-a22b-instruct, qwen3-vl-32b-instruct, qwen3-vl-30b-a3b-thinking, qwen3-vl-30b-a3b-instruct, qwen3-vl-8b-thinking, qwen3-vl-8b-instruct

  • Qwen-OCR シリーズモデル:qwen-vl-ocr, qwen-vl-ocr-2025-11-20

国際

  • Qwen-VL シリーズモデル

    • qwen3-vl-plus, qwen3-vl-plus-2025-12-19, qwen3-vl-plus-2025-09-23, qwen3-vl-flash, qwen3-vl-flash-2025-10-15, qwen3-vl-235b-a22b-thinking, qwen3-vl-235b-a22b-instruct, qwen3-vl-32b-instruct, qwen3-vl-30b-a3b-thinking, qwen3-vl-30b-a3b-instruct, qwen3-vl-8b-thinking, qwen3-vl-8b-instruct

    • qwen-vl-max, qwen-vl-max, qwen-vl-max-latest, qwen-vl-max-2025-08-13, qwen-vl-max-2025-04-08, qwen-vl-plus, qwen-vl-plus-latest, qwen-vl-plus-2025-08-15, qwen-vl-plus-2025-07-10, qwen-vl-plus-2025-05-07, qwen-vl-plus-2025-01-25, qwen2.5-vl-72b-instruct, qwen2.5-vl-32b-instruct, qwen2.5-vl-7b-instruct, qwen2.5-vl-3b-instruct

  • QVQ シリーズモデル:qvq-max, qvq-max-latest, qvq-max-2025-03-25

  • Qwen-OCR シリーズモデル:qwen-vl-ocr, qwen-vl-ocr-2025-11-20

米国

qwen3-vl-flash-us, qwen3-vl-flash-2025-10-15-us

中国本土

  • Qwen-VL シリーズモデル

    • qwen3-vl-plus, qwen3-vl-plus-2025-12-19, qwen3-vl-plus-2025-09-23, qwen3-vl-flash, qwen3-vl-flash-2025-10-15, qwen3-vl-235b-a22b-thinking, qwen3-vl-235b-a22b-instruct, qwen3-vl-32b-instruct, qwen3-vl-30b-a3b-thinking, qwen3-vl-30b-a3b-instruct, qwen3-vl-8b-thinking, qwen3-vl-8b-instruct

    • qwen-vl-max, qwen-vl-max, qwen-vl-max-latest, qwen-vl-max-2025-08-13, qwen-vl-max-2025-04-08, qwen-vl-max-2025-04-02, qwen-vl-max-2025-01-25, qwen-vl-max-2024-12-30, qwen-vl-max-2024-11-19, qwen-vl-plus, qwen-vl-plus-latest, qwen-vl-plus-2025-08-15, qwen-vl-plus-2025-07-10, qwen-vl-plus-2025-05-07, qwen-vl-plus-2025-01-25, qwen-vl-plus-2025-01-02, qwen2.5-vl-72b-instruct, qwen2.5-vl-32b-instruct, qwen2.5-vl-7b-instruct, qwen2.5-vl-3b-instruct, qwen2-vl-72b-instruct, qwen2-vl-7b-instruct, qwen2-vl-2b-instruct

  • QVQ シリーズモデル:qvq-max, qvq-max-latest, qvq-max-2025-03-25

  • Qwen-OCR シリーズモデル:qwen-vl-ocr, qwen-vl-ocr-latest, qwen-vl-ocr-2025-11-20, qwen-vl-ocr-2025-08-28, qwen-vl-ocr-2025-04-13, qwen-vl-ocr-2024-10-28

モデルの呼び出し

リクエストの例

このセクションでは、Python (OpenAI SDK と LangChain_OpenAI SDK を使用) と cURL (HTTP インターフェイスを使用) でのストリーミング呼び出しの例を示します。他のプログラミング言語や異なる入力メソッドの例については、「視覚的理解のリクエスト例」をご参照ください。

QVQ モデルはストリーミング出力のみをサポートしています。QVQ モデルの使用方法の詳細については、「視覚的推論」をご参照ください。

OpenAI SDK の使用

from openai import OpenAI
import os


def get_response():
    client = OpenAI(
    # API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください。
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 以下はシンガポールリージョンの base_url です。米国 (バージニア) リージョンのモデルを使用する場合は、base_url を https://dashscope-us.aliyuncs.com/compatible-mode/v1 に変更してください。
    # 中国 (北京) リージョンのモデルを使用する場合は、base_url を https://dashscope.aliyuncs.com/compatible-mode/v1 に置き換えてください。
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)
    completion = client.chat.completions.create(
        model="qwen3-vl-plus",
        messages=[
            {
              "role": "user",
              "content": [
                {
                  "type": "text",
                  "text": "What is this"
                },
                {
                  "type": "image_url",
                  "image_url": {
                    "url": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg"
                  }
                }
              ]
            }
          ],
        stream=True,
        stream_options={"include_usage":True}
        )
    for chunk in completion:
        print(chunk.model_dump())

if __name__=='__main__':
    get_response()

コードを実行すると、次の結果が返されます。

{'id': 'chatcmpl-31042a05-c968-4fc6-ba28-c3aa471258dc', 'choices': [{'delta': {'content': '', 'function_call': None, 'refusal': None, 'role': 'assistant', 'tool_calls': None}, 'finish_reason': None, 'index': 0, 'logprobs': None}], 'created': 1765780318, 'model': 'qwen-vl-plus', 'object': 'chat.completion.chunk', 'service_tier': None, 'system_fingerprint': None, 'usage': None}
{'id': 'chatcmpl-31042a05-c968-4fc6-ba28-c3aa471258dc', 'choices': [{'delta': {'content': 'This', 'function_call': None, 'refusal': None, 'role': None, 'tool_calls': None}, 'finish_reason': None, 'index': 0, 'logprobs': None}], 'created': 1765780318, 'model': 'qwen-vl-plus', 'object': 'chat.completion.chunk', 'service_tier': None, 'system_fingerprint': None, 'usage': None}
{'id': 'chatcmpl-31042a05-c968-4fc6-ba28-c3aa471258dc', 'choices': [{'delta': {'content': 'photo', 'function_call': None, 'refusal': None, 'role': None, 'tool_calls': None}, 'finish_reason': None, 'index': 0, 'logprobs': None}], 'created': 1765780318, 'model': 'qwen-vl-plus', 'object': 'chat.completion.chunk', 'service_tier': None, 'system_fingerprint': None, 'usage': None}
{'id': 'chatcmpl-31042a05-c968-4fc6-ba28-c3aa471258dc', 'choices': [{'delta': {'content': 'shows', 'function_call': None, 'refusal': None, 'role': None, 'tool_calls': None}, 'finish_reason': None, 'index': 0, 'logprobs': None}], 'created': 1765780318, 'model': 'qwen-vl-plus', 'object': 'chat.completion.chunk', 'service_tier': None, 'system_fingerprint': None, 'usage': None}

......

{'id': 'chatcmpl-31042a05-c968-4fc6-ba28-c3aa471258dc', 'choices': [{'delta': {'content': 'moment', 'function_call': None, 'refusal': None, 'role': None, 'tool_calls': None}, 'finish_reason': None, 'index': 0, 'logprobs': None}], 'created': 1765780318, 'model': 'qwen-vl-plus', 'object': 'chat.completion.chunk', 'service_tier': None, 'system_fingerprint': None, 'usage': None}
{'id': 'chatcmpl-31042a05-c968-4fc6-ba28-c3aa471258dc', 'choices': [{'delta': {'content': '.', 'function_call': None, 'refusal': None, 'role': None, 'tool_calls': None}, 'finish_reason': None, 'index': 0, 'logprobs': None}], 'created': 1765780318, 'model': 'qwen-vl-plus', 'object': 'chat.completion.chunk', 'service_tier': None, 'system_fingerprint': None, 'usage': None}
{'id': 'chatcmpl-31042a05-c968-4fc6-ba28-c3aa471258dc', 'choices': [{'delta': {'content': '', 'function_call': None, 'refusal': None, 'role': None, 'tool_calls': None}, 'finish_reason': 'stop', 'index': 0, 'logprobs': None}], 'created': 1765780318, 'model': 'qwen-vl-plus', 'object': 'chat.completion.chunk', 'service_tier': None, 'system_fingerprint': None, 'usage': None}
{'id': 'chatcmpl-31042a05-c968-4fc6-ba28-c3aa471258dc', 'choices': [], 'created': 1765780318, 'model': 'qwen-vl-plus', 'object': 'chat.completion.chunk', 'service_tier': None, 'system_fingerprint': None, 'usage': {'completion_tokens': 230, 'prompt_tokens': 1259, 'total_tokens': 1489, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': None, 'rejected_prediction_tokens': None, 'text_tokens': 230}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}}

langchain_openai SDK の使用

前提条件

  • お使いのコンピューターに Python 環境がインストールされていることを確認してください。

  • 次のコマンドを実行して、langchain_openai SDK をインストールします。

    # 次のコマンドが失敗した場合は、pip を pip3 に置き換えてください。
    pip install -U langchain_openai
  • Alibaba Cloud Model Studio をアクティベートし、API キーを取得します。手順については、「API キーの作成」をご参照ください。

  • API キーの漏洩リスクを減らすために、API キーを環境変数として設定することをお勧めします。詳細については、「API キーを環境変数として設定する」をご参照ください。コードに API キーをハードコーディングすることもできますが、これにより漏洩のリスクが高まります

使用方法

以下の例は、langchain_openai SDK で Qwen-VL を使用する方法を示しています。

非ストリーミング出力

次のサンプルコードに示すように、非ストリーミング出力には `invoke` メソッドを使用します。

from langchain_openai import ChatOpenAI
import os

def get_response():
    llm = ChatOpenAI(
      # API キーはリージョン固有です。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください。
      api_key=os.getenv("DASHSCOPE_API_KEY"),
      # 以下の base_url はシンガポールリージョン用です。バージニアリージョンのモデルを使用する場合は、base_url を https://dashscope-us.aliyuncs.com/compatible-mode/v1 に置き換えてください。
      # 北京リージョンのモデルを使用する場合は、base_url を https://dashscope.aliyuncs.com/compatible-mode/v1 に置き換えてください。
      base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
      model="qwen3-vl-plus",
      )
    messages= [
            {
              "role": "user",
              "content": [
                {
                  "type": "text",
                  "text": "What is this?"
                },
                {
                  "type": "image_url",
                  "image_url": {
                    "url": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg"
                  }
                }
              ]
            }
          ]
    response = llm.invoke(messages)
    print(response.content)

if __name__ == "__main__":
    get_response()

コードを実行すると、次の結果が返されます。

{
  "content": "写真では、女性と彼女の犬がビーチで交流しています。犬は地面に座り、握手かハイタッチをするかのように前足を差し出しています。女性はチェック柄のシャツを着ており、犬と親密に触れ合っているようで、微笑んでいます。背景は、日の出か日没の海と空です。これは、人とペットの間の友情の瞬間を捉えた、心温まる写真です。",
  "additional_kwargs": {
    "refusal": null
  },
  "response_metadata": {
    "token_usage": {
      "completion_tokens": 267,
      "prompt_tokens": 1259,
      "total_tokens": 1526,
      "completion_tokens_details": {
        "accepted_prediction_tokens": null,
        "audio_tokens": null,
        "reasoning_tokens": null,
        "rejected_prediction_tokens": null,
        "text_tokens": 267
      },
      "prompt_tokens_details": {
        "audio_tokens": null,
        "cached_tokens": 0
      }
    },
    "model_provider": "openai",
    "model_name": "qwen-vl-plus",
    "system_fingerprint": null,
    "id": "chatcmpl-9f3eba85-4f7a-4f73-b254-220a650xxxxx",
    "finish_reason": "stop",
    "logprobs": null
  },
  "type": "ai",
  "name": null,
  "id": "lc_run--019b1191-f411-7153-ac51-b8b0410xxxxx-0",
  "tool_calls": [],
  "invalid_tool_calls": [],
  "usage_metadata": {
    "input_tokens": 1259,
    "output_tokens": 267,
    "total_tokens": 1526,
    "input_token_details": {
      "cache_read": 0
    },
    "output_token_details": {}
  }
}

ストリーミング出力

次の例は QVQ モデルには適用されません。QVQ モデルの呼び出し方法については、「視覚的推論」をご参照ください。
from langchain_openai import ChatOpenAI
import os


def get_response():
    llm = ChatOpenAI(
        # API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください。
        api_key=os.getenv("DASHSCOPE_API_KEY"),
        # 以下はシンガポールリージョンの base_url です。米国 (バージニア) リージョンのモデルを使用する場合は、base_url を https://dashscope-us.aliyuncs.com/compatible-mode/v1 に変更してください。
        # 中国 (北京) リージョンのモデルを使用する場合は、base_url を https://dashscope.aliyuncs.com/compatible-mode/v1 に置き換えてください。
        base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
        model="qwen3-vl-plus",
        # これらの設定により、トークン使用量情報がストリーミング出力の最後のチャンクに表示されます。
        stream_options={"include_usage": True}
    )
    messages= [
            {
              "role": "user",
              "content": [
                {
                  "type": "text",
                  "text": "What is this"
                },
                {
                  "type": "image_url",
                  "image_url": {
                    "url": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg"
                  }
                }
              ]
            }
          ]
    response = llm.stream(messages)
    for chunk in response:
        print(chunk.json())

if __name__ == "__main__":
    get_response()

上記のコードを実行すると、次のサンプル結果が返されます。

{"content": "", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": "This", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " picture", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " shows", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " a", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " dog and a little", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " girl. The dog looks", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " friendly and may be", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " a pet, while the little girl", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " seems to be interacting", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " or playing with the dog.", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " This is a picture that shows", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " the warm relationship", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": " between humans and animals.", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": "", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": "", "additional_kwargs": {}, "response_metadata": {"finish_reason": "stop"}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": null, "tool_call_chunks": []}
{"content": "", "additional_kwargs": {}, "response_metadata": {}, "type": "AIMessageChunk", "name": null, "id": "run-xxx", "example": false, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": {"input_tokens": 23, "output_tokens": 40, "total_tokens": 63}, "tool_call_chunks": []}

入力パラメーターの設定方法については、「リクエストパラメーター」をご参照ください。これらのパラメーターは ChatOpenAI オブジェクトで定義されます。

HTTP インターフェイス経由の呼び出し

HTTP API を介して Qwen-VL モデルにアクセスできます。応答は、OpenAI サービスからの応答と同じ構造を持ちます。

前提条件

  • Alibaba Cloud Model Studio をアクティベートし、API キーを取得します。手順については、「API キーの作成」をご参照ください。

  • API キーの漏洩リスクを減らすために、API キーを環境変数として設定することをお勧めします。詳細については、「API キーを環境変数として設定する」をご参照ください。コードに API キーをハードコーディングすることもできますが、これにより漏洩のリスクが高まります

API 呼び出しの送信

シンガポール:POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions
バージニア:POST https://dashscope-us.aliyuncs.com/compatible-mode/v1/chat/completions
北京:POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions

リクエストの例

次の例は、curl コマンドを使用して API を呼び出すスクリプトを示しています。

説明

API キーを環境変数として設定していない場合は、$DASHSCOPE_API_KEY をご自身の API キーに置き換える必要があります

非ストリーミング出力

# ======= 重要 =======
# API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください。
# 以下はシンガポールリージョンの base_url です。米国 (バージニア) リージョンのモデルを使用する場合は、base_url を https://dashscope-us.aliyuncs.com/compatible-mode/v1/chat/completions に変更してください。
# 中国 (北京) リージョンのモデルを使用する場合は、base_url を https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions に置き換えてください。
# === 実行前にこのコメントを削除してください ===

curl --location 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
  "model": "qwen3-vl-plus",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What are these"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg"
          }
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/tiger.png"
          }
        }
      ]
    }
  ]
}'

コマンドを実行すると、次の結果が返されます。

{
  "choices": [
    {
      "message": {
        "content": "In Figure 1, a woman is interacting with her pet dog on the beach. The dog raises its front paw as if it wants to shake hands.\nFigure 2 is a CG-rendered picture of a tiger.",
        "role": "assistant"
      },
      "finish_reason": "stop",
      "index": 0,
      "logprobs": null
    }
  ],
  "object": "chat.completion",
  "usage": {
    "prompt_tokens": 2509,
    "completion_tokens": 34,
    "total_tokens": 2543
  },
  "created": 1724729556,
  "system_fingerprint": null,
  "model": "qwen-vl-plus",
  "id": "chatcmpl-1abb4eb9-f508-9637-a8ba-ac7fc6f73e53"
}

ストリーミング出力

ストリーミング出力を使用するには、リクエストボディで `stream` パラメーターを `true` に設定します。

# ======= 重要 =======
# API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください。
# 以下はシンガポールリージョンの base_url です。米国 (バージニア) リージョンのモデルを使用する場合は、base_url を https://dashscope-us.aliyuncs.com/compatible-mode/v1/chat/completions に変更してください。
# 中国 (北京) リージョンのモデルを使用する場合は、base_url を https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions に置き換えてください。
# === 実行前にこのコメントを削除してください ===

curl --location 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model": "qwen3-vl-plus",
    "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What is this"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg"
          }
        }
      ]
    }
  ],
    "stream":true,
    "stream_options":{"include_usage":true}
}'

コマンドを実行すると、次の結果が返されます。

data: {"choices":[{"delta":{"content":"","role":"assistant"},"index":0,"logprobs":null,"finish_reason":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"finish_reason":null,"delta":{"content":"In the"},"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" picture,"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" a woman"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" and her dog are"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" interacting on the beach. The dog is sitting on the ground,"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" extending its paw as if to shake hands or give"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" a high five. The woman is wearing a plaid"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" shirt and seems to be having an intimate"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" interaction with the dog, and is smiling."},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" The background is the ocean and the sky at sunrise or"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" sunset. This is"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"delta":{"content":" a heartwarming photo that shows"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[{"finish_reason":"stop","delta":{"content":" a moment of friendship between a person and a pet."},"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: {"choices":[],"object":"chat.completion.chunk","usage":{"prompt_tokens":1276,"completion_tokens":79,"total_tokens":1355},"created":1724729595,"system_fingerprint":null,"model":"qwen-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}

data: [DONE]

入力パラメーターの詳細については、「リクエストパラメーター」をご参照ください。

エラー応答の例

リクエストが失敗した場合、応答にはエラーの原因を示す `code` および `message` フィールドが含まれます。

{
    "error": {
        "message": "Incorrect API key provided. ",
        "type": "invalid_request_error",
        "param": null,
        "code": "invalid_api_key"
    }
}

エラーコード

ステータスコード」をご参照ください。