Model bahasa besar (LLM) tidak dapat mengakses data halaman web secara langsung. Web extractor mengambil konten dari URL yang ditentukan dan menyediakannya kepada model.
Penggunaan
Web extractor dapat dipanggil melalui tiga metode, masing-masing dengan parameter yang berbeda:
OpenAI-compatible - Responses API
Tambahkan web_search dan web_extractor ke parameter tools.
Saat menggunakan
qwen3-max-2026-01-23, aturenable_thinkingketrue.
Untuk akurasi yang lebih baik pada masalah matematika atau analitik data, aktifkan juga alat
code_interpreter.
# Impor dependensi dan buat klien...
response = client.responses.create(
model="qwen3.8-max",
input="Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content",
tools=[
# Untuk mengaktifkan ekstraksi web, aktifkan juga alat pencarian web
{"type": "web_search"},
{"type": "web_extractor"},
{"type": "code_interpreter"}
],
extra_body={
# Mode berpikir harus diaktifkan
"enable_thinking": True
}
)
print(response.output_text)
OpenAI-compatible - Chat Completions API
Atur enable_search ke true dan search_strategy ke agent_max. Atur juga enable_thinking ke true.
Keluaran non-streaming tidak didukung.
# Impor dependensi dan buat klien...
completion = client.chat.completions.create(
model="qwen3-max",
messages=[{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content"}],
extra_body={
"enable_thinking": True,
"enable_search": True,
"search_options": {"search_strategy": "agent_max"}
},
stream=True
)
DashScope
Atur enable_search ke true dan search_strategy ke agent_max. Atur juga enable_thinking ke true.
Keluaran non-streaming tidak didukung.
from dashscope import Generation
response = Generation.call(
model="qwen3-max",
messages=[{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content"}],
enable_search=True,
search_options={"search_strategy": "agent_max"},
enable_thinking=True,
result_format="message",
stream=True,
incremental_output=True
)
Model yang didukung
Model yang direkomendasikan
Responses API
Qwen-Max: seri Qwen3.8-Max, seri Qwen3.7-Max
Qwen-Plus: seri Qwen3.7-Plus, seri Qwen3.6-Plus, seri Qwen3.5-Plus
DeepSeek: deepseek-v4-flash, deepseek-v4-flash-0731, deepseek-v4-pro
GLM: glm-5.2
seri open-source Qwen3.8
Chat Completions API / DashScope
- Qwen-Max (mode berpikir): seri Qwen3-Max
- Qwen-Plus: seri Qwen3.5-Plus
Model lainnya
Model berikut juga mendukung fitur ini, tetapi performanya mungkin tidak sebaik model yang direkomendasikan. Fitur ini hanya tersedia melalui Responses API.
- Qwen-Flash: seri Qwen3.7-Flash, seri Qwen3.6-Flash, seri Qwen3.5-Flash
- seri open-source Qwen3.6 (kecuali qwen3.6-27b)
- seri open-source Qwen3.5
Mulai
Contoh berikut memanggil web extractor melalui Responses API untuk merangkum dokumen teknis.
Anda harus mendapatkan Kunci API dan mengonfigurasinya sebagai variabel lingkungan.
import os
from openai import OpenAI
client = OpenAI(
# Jika variabel lingkungan belum dikonfigurasi, ganti baris berikut dengan api_key="sk-xxx", menggunakan Kunci API Model Studio Anda.
api_key=os.getenv("DASHSCOPE_API_KEY"),
# Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
)
response = client.responses.create(
model="qwen3.8-max",
input="Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content",
tools=[
{
"type": "web_search"
},
{
"type": "web_extractor"
},
{
"type": "code_interpreter"
}
],
extra_body = {
"enable_thinking": True
}
)
# Hapus komentar baris berikut untuk melihat hasil proses antara
# print(response.output)
print("="*20+"Response Content"+"="*20)
print(response.output_text)
# Cetak jumlah pemanggilan alat
usage = response.usage
print("="*20+"Tool Call Count"+"="*20)
if hasattr(usage, 'x_tools') and usage.x_tools:
print(f"\nWeb extraction count: {usage.x_tools.get('web_extractor', {}).get('count', 0)}")
import OpenAI from "openai";
import process from 'process';
const openai = new OpenAI({
// Jika variabel lingkungan belum dikonfigurasi, ganti baris berikut dengan apiKey: "sk-xxx", menggunakan Kunci API Model Studio Anda.
apiKey: process.env.DASHSCOPE_API_KEY,
// Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
baseURL: "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
});
async function main() {
const response = await openai.responses.create({
model: "qwen3.8-max",
input: "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content",
tools: [
{ type: "web_search" },
{ type: "web_extractor" },
{ type: "code_interpreter" }
],
enable_thinking: true
});
console.log("====================Response Content====================");
console.log(response.output_text);
// Cetak jumlah pemanggilan alat
console.log("====================Tool Call Count====================");
if (response.usage && response.usage.x_tools) {
console.log(`Web extraction count: ${response.usage.x_tools.web_extractor?.count || 0}`);
console.log(`Web search count: ${response.usage.x_tools.web_search?.count || 0}`);
}
// Hapus komentar baris berikut untuk melihat hasil proses antara
// console.log(JSON.stringify(response.output[0], null, 2));
}
main();
# Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/responses \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.8-max",
"input": "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content",
"tools": [
{"type": "web_search"},
{"type": "web_extractor"},
{"type": "code_interpreter"}
],
"enable_thinking": true
}'
Contoh output:
====================Response Content====================
Based on the official Alibaba Cloud Model Studio documentation, I have summarized the core content of the **code interpreter** feature for you:
## 1. Feature Positioning
...
> **Document Source**: Alibaba Cloud Model Studio official documentation - [Qwen Code Interpreter](https://www.alibabacloud.com/help/en/model-studio/qwen-code-interpreter) and [Assistant API Code Interpreter](https://www.alibabacloud.com/help/en/model-studio/code-interpreter) (Updated: December 2025)
====================Tool Call Count====================
Web extraction count: 1
Keluaran streaming
Ekstraksi web bisa memakan waktu. Aktifkan keluaran streaming untuk menerima hasil antara secara real time.
Gunakan Responses API untuk memantau status eksekusi alat secara berkala.
OpenAI-compatible - Responses API
import os
from openai import OpenAI
client = OpenAI(
# Jika variabel lingkungan belum dikonfigurasi, ganti baris berikut dengan api_key="sk-xxx" (tidak disarankan), menggunakan Kunci API Model Studio Anda.
api_key=os.getenv("DASHSCOPE_API_KEY"),
# Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
)
stream = client.responses.create(
model="qwen3.8-max",
input="Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content",
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:
# Cetak proses berpikir
if chunk.type == 'response.reasoning_summary_text.delta':
if not reasoning_started:
print("="*20 + "Thinking Process" + "="*20)
reasoning_started = True
print(chunk.delta, end='', flush=True)
# Cetak saat pemanggilan alat selesai
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 Call" + "="*20)
print(chunk.item.goal)
print(chunk.item.output)
elif chunk.item.type == 'reasoning':
reasoning_started = False
# Cetak konten respons
elif chunk.type == 'response.output_text.delta':
if not output_started:
print("\n" + "="*20 + "Response Content" + "="*20)
output_started = True
print(chunk.delta, end='', flush=True)
# Saat respons selesai, cetak jumlah pemanggilan alat
elif chunk.type == 'response.completed':
print("\n" + "="*20 + "Tool Call Count" + "="*20)
usage = chunk.response.usage
if hasattr(usage, 'x_tools') and usage.x_tools:
print(f"Web extraction count: {usage.x_tools.get('web_extractor', {}).get('count', 0)}")
print(f"Web search count: {usage.x_tools.get('web_search', {}).get('count', 0)}")
import OpenAI from "openai";
import process from 'process';
const openai = new OpenAI({
// Jika variabel lingkungan belum dikonfigurasi, ganti baris berikut dengan apiKey: "sk-xxx", menggunakan Kunci API Model Studio Anda.
apiKey: process.env.DASHSCOPE_API_KEY,
// Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
baseURL: "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
});
async function main() {
const stream = await openai.responses.create({
model: "qwen3.8-max",
input: "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content",
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) {
// Cetak proses berpikir
if (chunk.type === 'response.reasoning_summary_text.delta') {
if (!reasoningStarted) {
console.log("====================Thinking Process====================");
reasoningStarted = true;
}
process.stdout.write(chunk.delta);
}
// Cetak saat pemanggilan alat selesai
else if (chunk.type === 'response.output_item.done') {
if (chunk.item && chunk.item.type === 'web_extractor_call') {
console.log("\n" + "====================Tool Call====================");
console.log(chunk.item.goal);
console.log(chunk.item.output);
} else if (chunk.item && chunk.item.type === 'reasoning') {
reasoningStarted = false;
}
}
// Cetak konten respons
else if (chunk.type === 'response.output_text.delta') {
if (!outputStarted) {
console.log("\n" + "====================Response Content====================");
outputStarted = true;
}
process.stdout.write(chunk.delta);
}
// Saat respons selesai, cetak jumlah pemanggilan alat
else if (chunk.type === 'response.completed') {
console.log("\n" + "====================Tool Call Count====================");
const usage = chunk.response.usage;
if (usage && usage.x_tools) {
console.log(`Web extraction count: ${usage.x_tools.web_extractor?.count || 0}`);
console.log(`Web search count: ${usage.x_tools.web_search?.count || 0}`);
}
}
}
}
main();
# Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/responses \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.8-max",
"input": "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content",
"tools": [
{"type": "web_search"},
{"type": "web_extractor"},
{"type": "code_interpreter"}
],
"enable_thinking": true,
"stream": true
}'
OpenAI-compatible - Chat Completions API
import os
from openai import OpenAI
client = OpenAI(
# Jika variabel lingkungan belum dikonfigurasi, ganti baris berikut dengan api_key="sk-xxx" (tidak disarankan), menggunakan Kunci API Model Studio Anda.
api_key=os.getenv("DASHSCOPE_API_KEY"),
# Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
)
stream = client.chat.completions.create(
model="qwen3-max",
messages=[
{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content"}
],
extra_body={
"enable_thinking": True,
"enable_search": True,
"search_options": {"search_strategy": "agent_max"}
},
stream=True
)
reasoning_started = False
output_started = False
for chunk in stream:
if chunk.choices:
delta = chunk.choices[0].delta
# Cetak proses berpikir
if hasattr(delta, 'reasoning_content') and delta.reasoning_content:
if not reasoning_started:
print("="*20 + "Thinking Process" + "="*20)
reasoning_started = True
print(delta.reasoning_content, end='', flush=True)
# Cetak konten respons
if delta.content:
if not output_started:
print("\n" + "="*20 + "Response Content" + "="*20)
output_started = True
print(delta.content, end='', flush=True)
import OpenAI from "openai";
import process from 'process';
const openai = new OpenAI({
// Jika variabel lingkungan belum dikonfigurasi, ganti baris berikut dengan apiKey: "sk-xxx", menggunakan Kunci API Model Studio Anda.
apiKey: process.env.DASHSCOPE_API_KEY,
// Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
baseURL: "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
});
async function main() {
const stream = await openai.chat.completions.create({
model: "qwen3-max",
messages: [
{ role: "user", content: "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content" }
],
enable_thinking: true,
enable_search: true,
search_options: { search_strategy: "agent_max" },
stream: true
});
let reasoningStarted = false;
let outputStarted = false;
for await (const chunk of stream) {
if (chunk.choices && chunk.choices.length > 0) {
const delta = chunk.choices[0].delta;
// Cetak proses berpikir
if (delta.reasoning_content) {
if (!reasoningStarted) {
console.log("====================Thinking Process====================");
reasoningStarted = true;
}
process.stdout.write(delta.reasoning_content);
}
// Cetak konten respons
if (delta.content) {
if (!outputStarted) {
console.log("\n" + "====================Response Content====================");
outputStarted = true;
}
process.stdout.write(delta.content);
}
}
}
}
main();
# Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-max",
"messages": [
{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content"}
],
"enable_thinking": true,
"enable_search": true,
"search_options": {"search_strategy": "agent_max"},
"stream": true
}'
DashScope
SDK Java tidak didukung.
import os
import dashscope
from dashscope import Generation
# Jika variabel lingkungan belum dikonfigurasi, ganti baris berikut dengan dashscope.api_key = "sk-xxx", menggunakan Kunci API Model Studio Anda.
dashscope.api_key = os.getenv("DASHSCOPE_API_KEY")
# Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
dashscope.base_http_api_url = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1"
response = Generation.call(
model="qwen3-max",
messages=[
{"role": "user", "content": "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content"}
],
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
for chunk in response:
if chunk.status_code == 200:
message = chunk.output.choices[0].message
# Cetak proses berpikir
if hasattr(message, 'reasoning_content') and message.reasoning_content:
if not reasoning_started:
print("="*20 + "Thinking Process" + "="*20)
reasoning_started = True
print(message.reasoning_content, end='', flush=True)
# Cetak konten respons
if hasattr(message, 'content') and message.content:
if not output_started:
print("\n" + "="*20 + "Response Content" + "="*20)
output_started = True
print(message.content, end='', flush=True)
else:
print(f"\nRequest failed: code={chunk.code}, message={chunk.message}")
break
# Wilayah Singapura. Ganti {WorkspaceId} dengan ID Workspace aktual Anda. URL berbeda tergantung wilayah.
curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.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",
"input": {
"messages": [
{
"role": "user",
"content": "Please visit the official Alibaba Cloud Model Studio documentation for the code interpreter and summarize its main content"
}
]
},
"parameters": {
"enable_thinking": true,
"enable_search": true,
"search_options": {
"search_strategy": "agent_max"
},
"result_format": "message"
}
}'
Tagihan
Tagihan mencakup:
-
Biaya pemanggilan model: Konten yang diekstraksi dari halaman web ditambahkan ke prompt, sehingga meningkatkan jumlah token input. Token tersebut ditagih sesuai tarif standar model. Untuk detail harga, lihat Konsol Model Studio.
-
Biaya pemanggilan alat: Termasuk ekstraksi web dan pencarian web.
-
Biaya pencarian web per 1.000 kali pemanggilan:
- Wilayah China (Beijing): $0,57341.
- Wilayah Singapura: $10,00.
-
Web extractor gratis untuk waktu terbatas.
-