Alibaba Cloud Model Studio の Qwen ビジョンモデルは、OpenAI インターフェイス仕様と互換性があります。既存の OpenAI アプリケーションを Model Studio に移行するには、3 つのパラメーターを変更するだけです。
-
base_url :
- 中国 (北京) : https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1
- シンガポール : https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1。{WorkspaceId} を実際のワークスペース ID に置き換えてください。
- 日本 (東京) : https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/compatible-mode/v1。{WorkspaceId} を実際のワークスペース ID に置き換えてください。
- 米国 (バージニア) : https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/compatible-mode/v1
- 中国 (香港) : https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1。
WorkspaceIdを実際のワークスペース ID に置き換えてください。
-
api_key :お使いのModel Studio の API キーに置き換えてください。
-
model :次のリストのモデル名に置き換えてください。
重要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へ - 中国 (香港):
https://cn-hongkong.dashscope.aliyuncs.comからhttps://{WorkspaceId}.cn-hongkong.maas.aliyuncs.comへ
{WorkspaceId} はワークスペース ID です。Alibaba Cloud Model Studio コンソールの ワークスペースの詳細 ページで確認できます。既存のドメインは引き続き問題なく利用できます。
サポートされているモデル
サポートされているモデルは、Qwen-VL、QVQ、Qwen-OCR です。
利用可能なモデルはリージョンによって異なります。詳細については、Model Studio コンソールをご参照ください。
モデルの呼び出し
例
このセクションでは、Python (OpenAI SDK および LangChain_OpenAI SDK) と cURL (HTTP) のストリーミング呼び出しの例を示します。他のプログラミング言語や入力メソッドの例については、「ビジョンリクエスト例」をご参照ください。
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。{WorkspaceId} を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
base_url="https://{WorkspaceId}.ap-southeast-1.maas.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': 'qwen3-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': 'qwen3-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': 'qwen3-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': 'qwen3-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': 'qwen3-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': 'qwen3-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': 'qwen3-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': 'qwen3-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
- Model Studio をアクティブ化し、API キーを取得する必要があります。詳細については、「API キーの取得」をご参照ください。
- 漏洩のリスクを減らすために、API キーを環境変数として設定することを推奨します。詳細については、「API キーを環境変数として設定する」をご参照ください。コード内で API キーを直接設定することもできますが、これにより漏洩のリスクが高まります。
使用方法
次の例を使用して、langchain_openai SDK 経由で Qwen ビジョンモデルを呼び出すことができます。
非ストリーミング出力
非ストリーミング出力では、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。{WorkspaceId} を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
base_url="https://{WorkspaceId}.ap-southeast-1.maas.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”: “This photo shows a woman and a dog interacting warmly on a beach. Here is a detailed description:\n\n1. **Scene**:\n - The photo is taken on a beach with the ocean and sky in the background.\n - The sun is about to set or has just risen, casting warm golden light on the sand.\n\n2. **Person**:\n - A woman is sitting on the sand, wearing a plaid shirt and dark pants.\n - She is smiling, appearing very happy and relaxed.\n\n3. **Animal**:\n - A yellow Labrador retriever is sitting next to the woman.\n - The dog is wearing a colorful harness and appears healthy and friendly.\n - The dog has placed its paw gently on the woman's hand, as if performing a \”handshake\” gesture.\n\n4. **Interaction**:\n - The interaction between the woman and the dog appears very intimate and joyful.\n - This interaction showcases the deep bond between humans and their pets.\n\n5. **Atmosphere**:\n - The overall atmosphere is very serene and beautiful, giving a sense of relaxation and happiness.\n - The sound of waves and the beauty of the sunset add a romantic touch to this scene.\n\nThis photo captures a simple and beautiful moment, showcasing the harmonious relationship between humans and their pets, as well as the tranquility and beauty that nature brings.”,
"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": "qwen3-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。{WorkspaceId} を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
base_url="https://{WorkspaceId}.ap-southeast-1.maas.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": " image", "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 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": " and a young", "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 is likely", "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 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 an image depicting", "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 bond between", "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": " 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": []}
入力パラメーターの設定については、「OpenAI 互換 - チャット」をご参照ください。関連するパラメーターは ChatOpenAI オブジェクトで定義されています。
HTTP
HTTP インターフェイスを介して Qwen ビジョンモデルを呼び出し、HTTP を介して OpenAI サービスを呼び出すのと同じ構造で応答を取得できます。
前提条件
- Model Studio をアクティブ化し、API キーを取得する必要があります。詳細については、「API キーの取得」をご参照ください。
- 漏洩のリスクを減らすために、API キーを環境変数として設定することを推奨します。詳細については、「API キーを環境変数として設定する」をご参照ください。コード内で API キーを直接設定することもできますが、これにより漏洩のリスクが高まります。
API エンドポイント
シンガポール : POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions
日本 (東京) : POST https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions
米国 (バージニア) : POST https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions
中国 (北京) : POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completions
中国 (香港) : POST https://{WorkspaceId}.cn-hongkong.maas.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
# シンガポールの URL。{WorkspaceId} を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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": "Image 1 shows a woman and her pet dog interacting on the beach, with the dog raising its front paw as if trying to shake hands.\nImage 2 is a CG-rendered image 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": "qwen3-vl-plus",
"id": "chatcmpl-1abb4eb9-f508-9637-a8ba-ac7fc6f73e53"
}
ストリーミング出力
ストリーミング出力を使用するには、リクエストボディで stream パラメーターを true に設定します。
# ======= 重要 =======
# API キーはリージョンによって異なります。API キーの取得: https://www.alibabacloud.com/help/model-studio/get-api-key
# シンガポールの URL。{WorkspaceId} を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"finish_reason":null,"delta":{"content":"The"},"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" image"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" shows a woman"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" and her dog on"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" the beach. The dog is sitting,"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" reaching out its paw as if to shake"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" hands. 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":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" shirt and appears to be closely"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" interacting with the dog, smiling."},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" The background features the ocean and a sunrise"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" or sunset sky. This is a"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"delta":{"content":" warm and heartfelt photo, capturing a"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: {"choices":[{"finish_reason":"stop","delta":{"content":" moment of friendship between humans and pets."},"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1724729595,"system_fingerprint":null,"model":"qwen3-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":"qwen3-vl-plus","id":"chatcmpl-4c83f437-303f-907b-9de5-79cac83d6b18"}
data: [DONE]
入力パラメーターの詳細については、「OpenAI 互換 - チャット」をご参照ください。
エラー応答の例
リクエストが失敗した場合、応答にはエラーの原因を示す code フィールドと message フィールドが含まれます。
{
"error": {
"message": "Incorrect API key provided. ",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}
ステータスコード
ステータスコード情報については、「OpenAI 互換 - チャット」をご参照ください。