ウェブエクストラクターツールは、指定された URL からコンテンツをフェッチして抽出し、モデルにウェブ情報を提供します。
使用方法
ウェブエクストラクターは 3 つの呼び出し方法をサポートしており、それぞれ異なる構成パラメーターがあります。
OpenAI 互換 Responses API
ウェブエクストラクターを使用するには、web_search と web_extractor の両方を tools に追加します。
qwen3-max-2026-01-23 を使用する場合、enable_thinking は true である必要があります。最良の結果を得るために、特に数学的計算やデータ分析の場合には、code_interpreter も使用して精度を向上させることを推奨します。# Import dependencies and create client...
response = client.responses.create(
model="qwen3-max-2026-01-23",
input="Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it",
tools=[
{"type": "web_search"},
{"type": "web_extractor"},
{"type": "code_interpreter"}
],
extra_body={
"enable_thinking": True
}
)
print(response.output_text)OpenAI 互換 Chat Completions API
enable_search と enable_thinking を true に設定し、search_strategy を agent_max に設定します。
ストリーミング以外の出力はサポートされていません。
# Import dependencies and create client...
completion = client.chat.completions.create(
model="qwen3-max-2026-01-23",
messages=[{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it"}],
extra_body={
"enable_thinking": True,
"enable_search": True,
"search_options": {"search_strategy": "agent_max"}
},
stream=True
)DashScope
enable_search と enable_thinking を true に設定し、search_strategy を agent_max に設定します。
ストリーミング以外の出力はサポートされていません。
from dashscope import Generation
response = Generation.call(
model="qwen3-max-2026-01-23",
messages=[{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it"}],
enable_search=True,
search_options={"search_strategy": "agent_max"},
enable_thinking=True,
result_format="message",
stream=True,
incremental_output=True
)利用可能状況
インターナショナル
Qwen-Max: 思考モードの
qwen3-maxおよびqwen3-max-2026-01-23Qwen-Plus:
qwen3.5-plus,qwen3.5-plus-2026-02-15Qwen-Flash:
qwen3.5-flash,qwen3.5-flash-2026-02-23オープンソース Qwen:
qwen3.5-397b-a17b,qwen3.5-122b-a10b,qwen3.5-27b,qwen3.5-35b-a3b
グローバル
Qwen-Plus:
qwen3.5-plus,qwen3.5-plus-2026-02-15Qwen-Flash:
qwen3.5-flash,qwen3.5-flash-2026-02-23オープンソース Qwen:
qwen3.5-397b-a17b,qwen3.5-122b-a10b,qwen3.5-27b,qwen3.5-35b-a3b
中国本土
Qwen-Max: 思考モードの
qwen3-maxおよびqwen3-max-2026-01-23Qwen-Plus:
qwen3.5-plus,qwen3.5-plus-2026-02-15Qwen-Flash:
qwen3.5-flash,qwen3.5-flash-2026-02-23オープンソース Qwen:
qwen3.5-397b-a17b,qwen3.5-122b-a10b,qwen3.5-27b,qwen3.5-35b-a3b
クイックスタート
Responses API を介してウェブエクストラクターツールを呼び出し、技術ドキュメントを自動的に要約します。
まず、API キーを取得し、API キーを環境変数としてエクスポートします。
import os
from openai import OpenAI
client = OpenAI(
# 環境変数を構成していない場合は、次の行を api_key="sk-xxx" に置き換えてください。
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1"
)
response = client.responses.create(
model="qwen3-max-2026-01-23",
input="Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it",
tools=[
{
"type": "web_search"
},
{
"type": "web_extractor"
},
{
"type": "code_interpreter"
}
],
extra_body = {
"enable_thinking": True
}
)
# 中間出力を表示するには、次の行のコメントを解除します
# print(response.output)
print("="*20+"Response"+"="*20)
print(response.output_text)
# ツール呼び出し回数を表示します
usage = response.usage
print("="*20+"Tool Invocation Count"+"="*20)
if hasattr(usage, 'x_tools') and usage.x_tools:
print(f"\nWeb Extractor invocations: {usage.x_tools.get('web_extractor', {}).get('count', 0)}")import OpenAI from "openai";
import process from 'process';
const openai = new OpenAI({
// 環境変数を構成していない場合は、次の行を apiKey: "sk-xxx" に置き換えてください。
apiKey: process.env.DASHSCOPE_API_KEY,
baseURL: "https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1"
});
async function main() {
const response = await openai.responses.create({
model: "qwen3-max-2026-01-23",
input: "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it",
tools: [
{ type: "web_search" },
{ type: "web_extractor" },
{ type: "code_interpreter" }
],
enable_thinking: true
});
console.log("====================Response====================");
console.log(response.output_text);
// ツール呼び出し回数を表示します
console.log("====================Tool Invocation Count====================");
if (response.usage && response.usage.x_tools) {
console.log(`Web Extractor invocations: ${response.usage.x_tools.web_extractor?.count || 0}`);
console.log(`Web Search invocations: ${response.usage.x_tools.web_search?.count || 0}`);
}
// 中間出力を表示するには、次の行のコメントを解除します
// console.log(JSON.stringify(response.output[0], null, 2));
}
main();curl -X POST https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1/responses \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-max-2026-01-23",
"input": "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it",
"tools": [
{"type": "web_search"},
{"type": "web_extractor"},
{"type": "code_interpreter"}
],
"enable_thinking": true
}'上記のコードを実行すると、次のような応答が生成されます。
====================Response====================
Based on the official Alibaba Cloud Model Studio documentation, here is a summary of the **Code Interpreter** feature:
## Overview
...
> **Source**: Alibaba Cloud Model Studio 公式ドキュメント - [Qwen Code Interpreter](https://www.alibabacloud.com/help/model-studio/qwen-code-interpreter) and [Assistant API Code Interpreter](https://www.alibabacloud.com/help/model-studio/code-interpreter) (最終更新日: December 2025)
====================Tool Invocation Count====================
Web Extractor invocations: 1ストリーミング出力
ウェブ抽出には時間がかかる場合があります。ストリーミング出力を使用して、中間結果をリアルタイムで受信します。
ツールの中間実行ステータスを取得するには、Responses API を使用することを推奨します。
OpenAI 互換 Responses API
import os
from openai import OpenAI
client = OpenAI(
# 環境変数を構成していない場合は、次の行を api_key="sk-xxx" に置き換えてください。
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://dashscope.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1"
)
stream = client.responses.create(
model="qwen3-max-2026-01-23",
input="Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it",
tools=[
{"type": "web_search"},
{"type": "web_extractor"},
{"type": "code_interpreter"}
],
stream=True,
extra_body={"enable_thinking": True}
)
reasoning_started = False
output_started = False
for chunk in stream:
# 推論プロセスを表示します
if chunk.type == 'response.reasoning_summary_text.delta':
if not reasoning_started:
print("="*20 + "Reasoning Process" + "="*20)
reasoning_started = True
print(chunk.delta, end='', flush=True)
# ツール呼び出しの完了を表示します
elif chunk.type == 'response.output_item.done':
if hasattr(chunk, 'item') and hasattr(chunk.item, 'type'):
if chunk.item.type == 'web_extractor_call':
print("\n" + "="*20 + "Tool Invocation" + "="*20)
print(chunk.item.goal)
print(chunk.item.output)
elif chunk.item.type == 'reasoning':
reasoning_started = False
# 応答コンテンツを表示します
elif chunk.type == 'response.output_text.delta':
if not output_started:
print("\n" + "="*20 + "Response" + "="*20)
output_started = True
print(chunk.delta, end='', flush=True)
# 応答が完了しました。ツール呼び出し回数を表示します
elif chunk.type == 'response.completed':
print("\n" + "="*20 + "Tool Invocation Count" + "="*20)
usage = chunk.response.usage
if hasattr(usage, 'x_tools') and usage.x_tools:
print(f"Web Extractor invocations: {usage.x_tools.get('web_extractor', {}).get('count', 0)}")
print(f"Web Search invocations: {usage.x_tools.get('web_search', {}).get('count', 0)}")import OpenAI from "openai";
import process from 'process';
const openai = new OpenAI({
// 環境変数を構成していない場合は、次の行を apiKey: "sk-xxx" に置き換えてください。
apiKey: process.env.DASHSCOPE_API_KEY,
baseURL: "https://dashscope.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1"
});
async function main() {
const stream = await openai.responses.create({
model: "qwen3-max-2026-01-23",
input: "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it",
tools: [
{ type: "web_search" },
{ type: "web_extractor" },
{ type: "code_interpreter" }
],
stream: true,
enable_thinking: true
});
let reasoningStarted = false;
let outputStarted = false;
for await (const chunk of stream) {
// 推論プロセスを表示します
if (chunk.type === 'response.reasoning_summary_text.delta') {
if (!reasoningStarted) {
console.log("====================Reasoning Process====================");
reasoningStarted = true;
}
process.stdout.write(chunk.delta);
}
// ツール呼び出しの完了を表示します
else if (chunk.type === 'response.output_item.done') {
if (chunk.item && chunk.item.type === 'web_extractor_call') {
console.log("\n" + "====================Tool Invocation====================");
console.log(chunk.item.goal);
console.log(chunk.item.output);
} else if (chunk.item && chunk.item.type === 'reasoning') {
reasoningStarted = false;
}
}
// 応答コンテンツを表示します
else if (chunk.type === 'response.output_text.delta') {
if (!outputStarted) {
console.log("\n" + "====================Response====================");
outputStarted = true;
}
process.stdout.write(chunk.delta);
}
// 応答が完了しました。ツール呼び出し回数を表示します
else if (chunk.type === 'response.completed') {
console.log("\n" + "====================Tool Invocation Count====================");
const usage = chunk.response.usage;
if (usage && usage.x_tools) {
console.log(`Web Extractor invocations: ${usage.x_tools.web_extractor?.count || 0}`);
console.log(`Web Search invocations: ${usage.x_tools.web_search?.count || 0}`);
}
}
}
}
main();curl -X POST https://dashscope.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1/responses \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-max-2026-01-23",
"input": "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it",
"tools": [
{"type": "web_search"},
{"type": "web_extractor"},
{"type": "code_interpreter"}
],
"enable_thinking": true,
"stream": true
}'OpenAI 互換 Chat Completions API
import os
from openai import OpenAI
client = OpenAI(
# 環境変数を構成していない場合は、次の行を api_key="sk-xxx" に置き換えてください。
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1"
)
stream = client.chat.completions.create(
model="qwen3-max-2026-01-23",
messages=[
{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it"}
],
extra_body={
"enable_search": True,
"search_options": {"search_strategy": "agent_max"}
},
stream=True
)
for chunk in stream:
print(chunk)import OpenAI from "openai";
import process from 'process';
const openai = new OpenAI({
// 環境変数を構成していない場合は、次の行を apiKey: "sk-xxx" に置き換えてください。
apiKey: process.env.DASHSCOPE_API_KEY,
baseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1"
});
async function main() {
const stream = await openai.chat.completions.create({
model: "qwen3-max-2026-01-23",
messages: [
{ role: "user", content: "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it" }
],
enable_search: true,
search_options: { search_strategy: "agent_max" },
stream: true
});
for await (const chunk of stream) {
console.log(chunk);
}
}
main();curl -X POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-max-2026-01-23",
"messages": [
{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it"}
],
"enable_search": true,
"search_options": {"search_strategy": "agent_max"},
"stream": true
}'DashScope
Java SDK はサポートされていません。
import os
import dashscope
from dashscope import Generation
# 環境変数を構成していない場合は、次の行を dashscope.api_key = "sk-xxx" に置き換えてください。
dashscope.api_key = os.getenv("DASHSCOPE_API_KEY")
response = Generation.call(
model="qwen3-max-2026-01-23",
messages=[
{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it"}
],
enable_search=True,
search_options={"search_strategy": "agent_max"},
enable_thinking=True,
result_format="message",
stream=True,
incremental_output=True
)
reasoning_started = False
output_started = False
last_usage = None
for chunk in response:
if chunk.status_code == 200:
message = chunk.output.choices[0].message
# 推論プロセスを表示します
if hasattr(message, 'reasoning_content') and message.reasoning_content:
if not reasoning_started:
print("="*20 + "Reasoning Process" + "="*20)
reasoning_started = True
print(message.reasoning_content, end='', flush=True)
# 応答コンテンツを表示します
if hasattr(message, 'content') and message.content:
if not output_started:
print("\n" + "="*20 + "Response" + "="*20)
output_started = True
print(message.content, end='', flush=True)
# 最後の使用状況情報を保存します
if hasattr(chunk, 'usage') and chunk.usage:
last_usage = chunk.usage
# ツール呼び出し回数を表示します
if last_usage:
print("\n" + "="*20 + "Tool Invocation Count" + "="*20)
if hasattr(last_usage, 'plugins') and last_usage.plugins:
print(f"Web Extractor invocations: {last_usage.plugins.get('web_extractor', {}).get('count', 0)}")curl -X POST https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "X-DashScope-SSE: enable" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-max-2026-01-23",
"input": {
"messages": [
{
"role": "user",
"content": "Please visit the official Alibaba Cloud Model Studio documentation, find the code interpreter topic and summarize it"
}
]
},
"parameters": {
"enable_thinking": true,
"enable_search": true,
"search_options": {
"search_strategy": "agent_max"
},
"result_format": "message"
}
}'課金
モデルコスト:抽出されたウェブコンテンツはプロンプトに追加され、モデルの入力トークンを増加させます。これは、モデルに記載されているモデルの標準価格で課金されます。
ツールコスト:ウェブエクストラクターとウェブ検索の両方の料金が含まれます。
ウェブ検索の1,000回の呼び出しあたりの料金:
中国本土およびグローバル:$0.57341。
国際:$10.00。
ウェブエクストラクターツールは現在、期間限定で無料です。