全部产品
Search
文档中心

Alibaba Cloud Model Studio:Web extractor

更新时间:Feb 05, 2026

Alat Web extractor mengambil dan mengekstrak konten dari URL yang ditentukan, menyediakan informasi web bagi model.

Penggunaan

Web extractor mendukung tiga metode pemanggilan, masing-masing dengan parameter konfigurasi yang berbeda:

OpenAI-compatible Responses API

Untuk menggunakan Web extractor, tambahkan web_search dan web_extractor ke dalam tools.

Saat menggunakan qwen3-max-2026-01-23, parameter enable_thinking harus diatur ke true.
Untuk hasil terbaik, terutama dalam perhitungan matematis atau analitik data, gunakan juga code_interpreter guna meningkatkan akurasi.
# Impor dependensi dan buat 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-Compatible Chat Completions API

Atur enable_search dan enable_thinking ke true, serta atur search_strategy ke agent_max.

Keluaran non-streaming tidak didukung.
# Impor dependensi dan buat 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

Atur enable_search dan enable_thinking ke true, serta atur search_strategy ke agent_max.

Keluaran non-streaming tidak didukung.
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
)

Ketersediaan

Mendukung (hanya untuk Responses API) serta qwen3-max dan qwen3-max-2026-01-23 dalam mode thinking. Responses API hanya tersedia di Wilayah internasional.

Memulai

Panggil alat Web extractor melalui Responses API untuk secara otomatis merangkum dokumen teknis.

Pertama, dapatkan Kunci API dan ekspor Kunci API sebagai Variabel lingkungan.
import os
from openai import OpenAI

client = OpenAI(
    # Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan: 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
    }
)
# Hapus komentar pada baris berikut untuk melihat hasil antara
# print(response.output)
print("="*20+"Response"+"="*20)
print(response.output_text)
# Cetak jumlah pemanggilan tool
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({
    // Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan: 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);

    // Cetak jumlah pemanggilan tool
    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}`);
    }
    // Hapus komentar pada baris berikut untuk melihat hasil antara
    // 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
}'

Menjalankan kode di atas menghasilkan respons yang mirip dengan:

====================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 Official Documentation - [Qwen Code Interpreter](https://www.alibabacloud.com/help/zh/model-studio/qwen-code-interpreter) and [Assistant API Code Interpreter](https://www.alibabacloud.com/help/zh/model-studio/code-interpreter) (Last updated: December 2025)
====================Tool Invocation Count====================

Web Extractor invocations: 1

Keluaran streaming

Ekstraksi web dapat memakan waktu. Gunakan keluaran streaming untuk menerima hasil antara secara real time.

Kami merekomendasikan penggunaan Responses API untuk mengambil status eksekusi antara dari tool.

OpenAI-Compatible Responses API

import os
from openai import OpenAI

client = OpenAI(
    # Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan: 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:
    # Cetak proses reasoning
    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)
    # Cetak penyelesaian pemanggilan tool
    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
    # Cetak konten respons
    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)
    # Respons selesai, cetak jumlah pemanggilan tool
    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({
    // Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan: 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) {
        // Cetak proses reasoning
        if (chunk.type === 'response.reasoning_summary_text.delta') {
            if (!reasoningStarted) {
                console.log("====================Reasoning Process====================");
                reasoningStarted = true;
            }
            process.stdout.write(chunk.delta);
        }
        // Cetak penyelesaian pemanggilan tool
        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;
            }
        }
        // Cetak konten respons
        else if (chunk.type === 'response.output_text.delta') {
            if (!outputStarted) {
                console.log("\n" + "====================Response====================");
                outputStarted = true;
            }
            process.stdout.write(chunk.delta);
        }
        // Respons selesai, cetak jumlah pemanggilan tool
        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-Compatible Chat Completions API

import os
from openai import OpenAI

client = OpenAI(
    # Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan: 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({
    // Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan: 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 tidak didukung.
import os
import dashscope
from dashscope import Generation

# Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan: 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

        # Cetak proses reasoning
        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)

        # Cetak konten respons
        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)

        # Simpan info penggunaan terakhir
        if hasattr(chunk, 'usage') and chunk.usage:
            last_usage = chunk.usage

# Cetak jumlah pemanggilan tool
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"
    }
}'

Penagihan

  • Biaya model: Konten web yang diekstrak ditambahkan ke prompt, sehingga meningkatkan jumlah token input model. Biaya ini dikenakan sesuai harga standar model, sebagaimana tercantum di Models.

  • Biaya tool: Termasuk biaya untuk web extractor dan web search.

    • Harga web search per 1.000 kali pemanggilan:

      • Tiongkok Daratan: $0,57341.

      • Internasional: $10,00.

    • Tool web extractor saat ini gratis untuk waktu terbatas.