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

Alibaba Cloud Model Studio:OpenAI Responses API Reference

最終更新日:Feb 25, 2026

このトピックでは、OpenAI 互換の Responses API を使用して Qwen モデルを呼び出す方法について説明します。また、入出力パラメーターを解説し、コードサンプルを提供します。

OpenAI Chat Completions API に対する利点:

  • 組み込みツール:ウェブ検索、ウェブ抽出、コードインタープリター、テキストからの画像検索、画像からの画像検索、ナレッジベース検索が含まれます。これらのツールは、複雑なタスクに対してより良い結果を提供します。詳細については、「ツール呼び出し」をご参照ください。

  • より柔軟な入力:モデル入力として文字列を直接渡すことをサポートし、チャットフォーマットのメッセージ配列とも互換性があります。

  • 簡素化されたコンテキスト管理:メッセージ履歴の配列を手動で構築する代わりに、前の応答から previous_response_id を渡します。

互換性に関する注意と制限事項

この API は、移行コストを削減するために OpenAI との互換性を持つように設計されています。ただし、パラメーター、特徴、および特定の動作には違いがあります。

基本原則:リクエストは、このドキュメントに明示的に記載されているパラメーターのみを処理します。記載されていない OpenAI パラメーターはすべて無視されます。

以下は、迅速に適応するための主な違いです:

  • サポートされていないパラメーターinstructionsbackground など、一部の OpenAI Responses API パラメーターはサポートされていません。現在、同期呼び出しのみがサポートされています。

  • 追加パラメーター:この API は、enable_thinking などの追加パラメーターをサポートしています。具体的な使用方法については、対応するパラメーターの説明をご参照ください。

シンガポール

SDK の base_urlhttps://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1

HTTP エンドポイント:POST https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1/responses

China (Beijing)

SDK の base_urlhttps://dashscope.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1

HTTP エンドポイント:POST https://dashscope.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1/responses

リクエストボディ

基本的な呼び出し

Python

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.5-plus",
    input="What can you do?"
)

# モデルの応答を取得
print(response.output_text)

Node.js

import OpenAI from "openai";

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.5-plus",
        input: "What can you do?"
    });

    // モデルの応答を取得
    console.log(response.output_text);
}

main();

curl

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.5-plus",
    "input": "What can you do?"
}'

ストリーミング出力

Python

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    base_url="https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1",
)

stream = client.responses.create(
    model="qwen3.5-plus",
    input="Please briefly introduce artificial intelligence.",
    stream=True
)

print("Receiving stream output:")
for event in stream:
    if event.type == 'response.output_text.delta':
        print(event.delta, end='', flush=True)
    elif event.type == 'response.completed':
        print("\nStream completed")
        print(f"Total tokens: {event.response.usage.total_tokens}")

Node.js

import OpenAI from "openai";

const openai = new OpenAI({
    apiKey: process.env.DASHSCOPE_API_KEY,
    baseURL: "https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1"
});

async function main() {
    const stream = await openai.responses.create({
        model: "qwen3.5-plus",
        input: "Please briefly introduce artificial intelligence.",
        stream: true
    });

    console.log("Receiving stream output:");
    for await (const event of stream) {
        if (event.type === 'response.output_text.delta') {
            process.stdout.write(event.delta);
        } else if (event.type === 'response.completed') {
            console.log("\nStream completed");
            console.log(`Total tokens: ${event.response.usage.total_tokens}`);
        }
    }
}

main();

curl

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" \
--no-buffer \
-d '{
    "model": "qwen3.5-plus",
    "input": "Please briefly introduce artificial intelligence.",
    "stream": true
}'

マルチターン対話

Python

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    base_url="https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1",
)

# 1ターン目
response1 = client.responses.create(
    model="qwen3.5-plus",
    input="私の名前は田中です。覚えておいてください。"
)
print(f"First response: {response1.output_text}")

# 2ターン目 - previous_response_id を使用してコンテキストを連携
# 応答 ID は 7 日後に失効します
response2 = client.responses.create(
    model="qwen3.5-plus",
    input="私の名前を覚えていますか?",
    previous_response_id=response1.id
)
print(f"Second response: {response2.output_text}")

Node.js

import OpenAI from "openai";

const openai = new OpenAI({
    apiKey: process.env.DASHSCOPE_API_KEY,
    baseURL: "https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1"
});

async function main() {
    // 1ターン目
    const response1 = await openai.responses.create({
        model: "qwen3.5-plus",
        input: "私の名前は田中です。覚えておいてください。"
    });
    console.log(`First response: ${response1.output_text}`);

    // 2ターン目 - previous_response_id を使用してコンテキストを連携
    // 応答 ID は 7 日後に失効します
    const response2 = await openai.responses.create({
        model: "qwen3.5-plus",
        input: "私の名前を覚えていますか?",
        previous_response_id: response1.id
    });
    console.log(`Second response: ${response2.output_text}`);
}

main();

組み込みツールの呼び出し

Python

import os
from openai import OpenAI

client = OpenAI(
    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.5-plus",
    input="Find the Alibaba Cloud website and extract key information",
    # 最良の結果を得るために、組み込みツールを有効にすることを推奨します
    tools=[
        {"type": "web_search"},
        {"type": "code_interpreter"},
        {"type": "web_extractor"}
    ],
    extra_body={"enable_thinking": True}
)

# 中間出力を確認するには、以下の行のコメントを解除してください
# print(response.output)
print(response.output_text)

Node.js

import OpenAI from "openai";

const openai = new OpenAI({
    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.5-plus",
        input: "Find the Alibaba Cloud website and extract key information",
        tools: [
            { type: "web_search" },
            { type: "code_interpreter" },
            { type: "web_extractor" }
        ],
        enable_thinking: true
    });

    for (const item of response.output) {
        if (item.type === "reasoning") {
            console.log("Model is thinking...");
        } else if (item.type === "web_search_call") {
            console.log(`Search query: ${item.action.query}`);
        } else if (item.type === "web_extractor_call") {
            console.log("Extracting web content...");
        } else if (item.type === "message") {
            console.log(`Response: ${item.content[0].text}`);
        }
    }
}

main();

curl

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.5-plus",
    "input": "Find the Alibaba Cloud website and extract key information",
    "tools": [
        {
            "type": "web_search"
        },
        {
            "type": "code_interpreter"
        },
        {
            "type": "web_extractor"
        }
    ],
    "enable_thinking": true
}'

model string (必須)

モデル名。サポートされているモデルには、qwen3-maxqwen3-max-2026-01-23qwen3.5-plusqwen3.5-plus-2026-02-15qwen3.5-397b-a17bqwen3.5-flashqwen3.5-flash-2026-02-23qwen3.5-122b-a10bqwen3.5-27bqwen3.5-35b-a3b、および が含まれます。

input string or array (必須)

モデルの入力。以下のフォーマットがサポートされています:

  • string:プレーンテキスト入力。例:"Hello"

  • array:対話の順序で配置されたメッセージ配列。

配列メッセージのタイプ

システムメッセージ object (任意)

モデルのロール、トーン、タスクの目的、または制約を設定するシステムメッセージ。使用する場合、メッセージ配列の最初の要素でなければなりません。

プロパティ

role string (必須)

メッセージのロール。値は system でなければなりません。

content string (必須)

モデルのロール、動作、応答スタイル、およびタスクの制約を定義するシステム命令の内容。

ユーザーメッセージ object (必須)

モデルに質問、命令、またはコンテキストを渡すユーザーメッセージ。

プロパティ

role string (必須)

メッセージのロール。値は user でなければなりません。

content string or array (必須)

メッセージの内容。入力がテキストのみの場合はデータの型は文字列です。入力に画像が含まれる場合、または明示的なキャッシュが有効になっている場合は配列です。

Responses API は現在、ビデオまたはオーディオ入力をサポートしていません。Chat Completions API または DashScope API を使用してビデオまたはオーディオを入力できます。

プロパティ

type string (必須)

有効な値:

  • text

    テキスト入力の場合は text に設定します。

  • image_url

    画像入力の場合は image_url に設定します。

text string

typetext の場合に必須です。

image_url string

入力画像の公開 URL または Base64 エンコードされたデータ。typeimage_url の場合に必須です。ローカルファイルをアップロードするには、「画像とビデオの理解」をご参照ください。

アシスタントメッセージ object (任意)

以前のモデルの応答を含むアシスタントメッセージで、マルチターン対話でコンテキストを提供するために使用されます。

プロパティ

role string (必須)

メッセージのロール。値は assistant でなければなりません。

content string (必須)

アシスタントの返信のテキスト内容。

previous_response_id string (任意)

前の応答の一意の ID。現在の応答の id は 7 日間有効です。このパラメーターを使用してマルチターン対話を作成できます。サーバーはそのターンの入力と出力を自動的に取得してコンテキストとして結合します。input メッセージ配列と previous_response_id の両方が提供された場合、input 内の新しいメッセージは履歴コンテキストに追加されます。

stream boolean (任意) デフォルトは false

ストリーミング出力を有効にするかどうかを指定します。このパラメーターが true に設定されている場合、モデルの応答データはリアルタイムでクライアントにストリーミングされます。

tools array (任意)

モデルが応答を生成する際に呼び出すことができるツールの配列。組み込みツールとユーザー定義関数ツールの混在をサポートします。

最良の応答を得るために、code_interpreterweb_search、および web_extractor ツールを一緒に有効にすることを推奨します。

プロパティ

web_search

モデルがインターネット上の最新情報を検索できるようにするウェブ検索ツール。詳細については、「ウェブ検索」をご参照ください。

プロパティ

type string (必須)

値は web_search でなければなりません。

例:[{"type": "web_search"}]

web_extractor

モデルがウェブページのコンテンツにアクセスして抽出できるようにするウェブページ抽出ツール。web_search ツールと一緒に使用する必要があります。qwen3-max および qwen3-max-2026-01-23 モデルでは、思考モードを有効にする必要があります。詳細については、「ウェブ抽出」をご参照ください。

プロパティ

type string (必須)

値は web_extractor でなければなりません。

例:[{"type": "web_search"}, {"type": "web_extractor"}]

code_interpreter

モデルがコードを実行し、データ分析の結果を返すことを可能にするコードインタープリターツール。qwen3-max および qwen3-max-2026-01-23 モデルでは、思考モードを有効にする必要があります。詳細については、「コードインタープリター」をご参照ください。

プロパティ

type string (必須)

値は code_interpreter でなければなりません。

例:[{"type": "code_interpreter"}]

web_search_image

テキスト記述に基づいて画像を検索します。詳細については、「テキストからの画像検索」をご参照ください。

プロパティ

type string (必須)

値は web_search_image でなければなりません。

例:[{"type": "web_search_image"}]

image_search

画像に基づいて類似または関連する画像を検索します。入力には画像 URL が含まれている必要があります。詳細については、「画像検索」をご参照ください。

プロパティ

type string (必須)

値は image_search でなければなりません。

例:[{"type": "image_search"}]

file_search

アップロードまたは関連付けられたナレッジベースで検索します。詳細については、「ナレッジ取得」をご参照ください。

プロパティ

type string (必須)

値は file_search でなければなりません。

vector_store_ids array (必須)

取得するナレッジベースの ID。現在、1 つのナレッジベース ID のみがサポートされています。

例:[{"type": "file_search", "vector_store_ids": ["your_knowledge_base_id"]}]

MCP 呼び出し

Model Context Protocol (MCP) を介して外部サービスを呼び出します。詳細については、「MCP」をご参照ください。

プロパティ

type string (必須)

値は mcp でなければなりません。

server_protocol string (必須)

MCP サービスとの通信プロトコル。例:"sse"

server_label string (必須)

MCP サービスを識別するサービスラベル。

server_description string (任意)

モデルがその機能とシナリオを理解するのに役立つサービスの説明。

server_url string (必須)

MCP サービスエンドポイントの URL。

headers object (任意)

本人確認などの情報を運ぶために使用されるリクエストヘッダー。例:Authorization

例:

mcp_tool = {
    "type": "mcp",
    "server_protocol": "sse",
    "server_label": "amap-maps",
    "server_description": "AMAP MCP Server now covers 15 core APIs, providing a full range of geographic information services, including generating exclusive maps, navigating to destinations, hailing rides, geocoding, reverse geocoding, IP locating, weather querying, and planning cycling, walking, driving, and public transit routes, distance measurement, keyword search, nearby search, and details search.",
    "server_url": "https://dashscope.aliyuncs.com/api/v1/mcps/amap-maps/sse",
    "headers": {
        "Authorization": "Bearer <your-mcp-server-token>"
    }
}

カスタムツール 関数

モデルが定義した関数を呼び出すことを可能にするユーザー定義関数ツール。モデルがツールを呼び出すことを決定すると、応答は function_call タイプの出力を返します。詳細については、「関数呼び出し」をご参照ください。

プロパティ

type string (必須)

値は function でなければなりません。

name string (必須)

ツール名。名前には文字、数字、アンダースコア (_)、およびハイフン (-) のみを含めることができます。最大長は 64 トークンです。

description string (必須)

モデルがいつ、どのようにツールを呼び出すかを決定するのに役立つツールの説明。

parameters object (任意)

ツールのパラメーターの説明。説明は有効な JSON スキーマでなければなりません。parameters パラメーターが空の場合、ツールには時間クエリツールなどの入力パラメーターがありません。

ツール呼び出しの精度を向上させるために、parameters を渡すことを推奨します。

例:

[{
  "type": "function",
  "name": "get_weather",
  "description": "Get weather information for a specified city",
  "parameters": {
    "type": "object",
    "properties": {
      "city": {
        "type": "string",
        "description": "The name of the city"
      }
    },
    "required": ["city"]
  }
}]

tool_choice string or object (任意) デフォルトは auto

モデルがツールを選択および呼び出す方法を制御します。このパラメーターは、文字列フォーマットとオブジェクトフォーマットの 2 つのフォーマットをサポートします。

文字列パターン

  • auto:モデルはツールを呼び出すかどうかを自動的に決定します。

  • none:モデルがツールを呼び出すのを防ぎます。

  • required:モデルにツールを強制的に呼び出させます。tools リストに 1 つのツールしかない場合にのみ使用できます。

オブジェクトフォーマット

モデルが利用できるツールの範囲を指定します。モデルは、事前定義されたリストからのみツールを選択して呼び出すことができます。

プロパティ

mode string (必須)

  • auto:モデルはツールを呼び出すかどうかを自動的に決定します。

  • required:モデルにツールを強制的に呼び出させます。tools リストに 1 つのツールしかない場合にのみ使用できます。

tools array (必須)

モデルが呼び出すことを許可されているツール定義のリスト。

[
  { "type": "function", "name": "get_weather" }
]

type string (必須)

許可されたツール構成のタイプ。値は allowed_tools でなければなりません。

temperature float (任意)

生成されるテキストの多様性を制御するサンプリング温度。

温度が高いほど、生成されるテキストの多様性が増します。温度が低いほど、より決定論的なテキストになります。

有効値: [0, 2)

temperature と top_p の両方が生成されるテキストの多様性を制御します。どちらか一方のみを設定することを推奨します。詳細については、「テキスト生成モデルの概要」をご参照ください。

top_p float (任意)

生成されるテキストの多様性を制御するニュークリアスサンプリングの確率しきい値。

top_p の値が高いほど、生成されるテキストの多様性が増します。top_p の値が低いほど、より決定論的なテキストになります。

有効値:(0, 1.0]

temperature と top_p の両方が生成されるテキストの多様性を制御します。どちらか一方のみを設定することを推奨します。詳細については、「テキスト生成モデルの概要」をご参照ください。

enable_thinking boolean (任意)

思考モードを有効にするかどうかを指定します。true に設定すると、モデルは返信する前に思考します。思考内容は、reasoning タイプの出力項目を介して返されます。思考モードが有効な場合、複雑なタスクで最高のモデルパフォーマンスを達成するために、組み込みツールを有効にすることを推奨します。

有効な値:

  • true

  • false

モデルごとのデフォルト値:「サポートされているモデル

このパラメーターは標準の OpenAI パラメーターではありません。Python SDK は extra_body={"enable_thinking": True} を使用して渡します。Node.js SDK と curl は、トップレベルパラメーターとして直接 enable_thinking: true を使用します。

レスポンスオブジェクト (非ストリーミング出力)

{
    "created_at": 1771165900.0,
    "id": "f75c28fb-4064-48ed-90da-4d2cc4362xxx",
    "model": "qwen3.5-plus",
    "object": "response",
    "output": [
        {
            "content": [
                {
                    "annotations": [],
                    "text": "こんにちは!私は Alibaba Cloud が開発した大規模言語モデル Qwen3.5 です。2026年までの知識を持ち、複雑な推論、創造的なタスク、多言語での会話を支援するために設計されています。",
                    "type": "output_text"
                }
            ],
            "id": "msg_89ad23e6-f128-4d4c-b7a1-a786e7880xxx",
            "role": "assistant",
            "status": "completed",
            "type": "message"
        }
    ],
    "parallel_tool_calls": false,
    "status": "completed",
    "tool_choice": "auto",
    "tools": [],
    "usage": {
        "input_tokens": 57,
        "input_tokens_details": {
            "cached_tokens": 0
        },
        "output_tokens": 44,
        "output_tokens_details": {
            "reasoning_tokens": 0
        },
        "total_tokens": 101,
        "x_details": [
            {
                "input_tokens": 57,
                "output_tokens": 44,
                "total_tokens": 101,
                "x_billing_type": "response_api"
            }
        ]
    }
}

id string

この応答の一意の ID。7 日間有効です。このパラメーターを previous_response_id パラメーターで使用して、マルチターン対話を作成できます。

created_at integer

このリクエストの Unix タイムスタンプ (秒単位)。

object string

オブジェクトタイプ。値は response です。

status string

応答生成のステータス。有効な値:

  • completed:生成プロセスは完了しました。

  • failed:生成に失敗しました。

  • in_progress:進行中

  • cancelled:キャンセルされました

  • queued:リクエストはキューにあります。

  • incomplete:不完全な生成

model string

応答の生成に使用されたモデルの ID。

output array

モデルによって生成された出力項目の配列。配列内の要素のタイプと順序は、モデルの応答によって異なります。

配列要素のプロパティ

type string

出力項目のタイプ。有効な値:

  • message:メッセージタイプ。モデルによって生成された最終的な返信内容が含まれます。

  • reasoning:推論タイプ。このタイプは、思考モード (enable_thinking: true) が有効な場合に返されます。推論トークンは output_tokens_details.reasoning_tokens でカウントされ、推論トークンとして課金されます。

  • function_call:関数呼び出しタイプ。このタイプは、ユーザー定義の function ツールが使用された場合に返されます。関数呼び出しを処理し、結果を返す必要があります。

  • web_search_call:検索呼び出しタイプ。このタイプは、web_search ツールが使用された場合に返されます。

  • code_interpreter_call:コード実行タイプ。このタイプは、code_interpreter ツールが使用された場合に返されます。

  • web_extractor_call:ウェブページ抽出タイプ。このタイプは、web_extractor ツールが使用された場合に返されます。web_search ツールと一緒に使用する必要があります。

  • web_search_image_call:テキストからの画像検索呼び出しタイプ。このタイプは、web_search_image ツールが使用された場合に返されます。検索された画像のリストが含まれます。

  • image_search_call:画像からの画像検索呼び出しタイプ。このタイプは、image_search ツールが使用された場合に返されます。類似画像のリストが含まれます。

  • mcp_call:MCP 呼び出しタイプ。このタイプは、mcp ツールが使用された場合に返されます。MCP サービス呼び出しの結果が含まれます。

  • file_search_call:ナレッジベース検索呼び出しタイプ。このタイプは、file_search ツールが使用された場合に返されます。ナレッジベースからの検索クエリと結果が含まれます。

id string

出力項目の一意の識別子。このフィールドは、すべてのタイプの出力項目に含まれます。

role string

メッセージのロール。値は assistant です。このフィールドは、typemessage の場合にのみ存在します。

status string

出力項目のステータス。有効な値:completed (完了) および in_progress (進行中)。このパラメーターは、type が bu の場合に存在します。

name string

ツールまたは関数名。このフィールドは、typefunction_callweb_search_image_callimage_search_call、または mcp_call の場合に存在します。

web_search_image_call および image_search_call の場合、値はそれぞれ "web_search_image" および "image_search" に固定されます。

mcp_call の場合、値は MCP サービスで呼び出された特定の関数名です。例:amap-maps-maps_geo

arguments string

ツール呼び出しの引数 (JSON 文字列形式)。このフィールドは、typefunction_callweb_search_image_callimage_search_call、または mcp_call の場合に存在します。使用する前に JSON.parse() を使用して解析する必要があります。ツールタイプごとの引数内容:

  • web_search_image_call{"queries": ["search term 1", "search term 2"]}。ここで queries は、ユーザー入力に基づいてモデルが自動生成した検索語のリストです。

  • image_search_call{"img_idx": 0, "bbox": [0, 0, 1000, 1000]}。ここで img_idx は入力画像のインデックス (0 から開始)、bbox は検索エリアのバウンディングボックス座標 [x1, y1, x2, y2] で、範囲は 0~1000 です。

  • function_call:ユーザー定義関数のパラメーターのスキーマに従って生成された引数オブジェクト。

  • mcp_call:MCP サービスで呼び出された関数の引数オブジェクト。

call_id string

関数呼び出しの一意の識別子。このフィールドは、typefunction_call の場合にのみ存在します。関数呼び出しの結果を返す際には、この ID を使用してリクエストと応答を関連付ける必要があります。

content array

メッセージコンテンツの配列。このフィールドは、typemessage の場合にのみ存在します。

配列要素のプロパティ

type string

コンテンツタイプ。値は output_text です。

text string

モデルによって生成されたテキストコンテンツ。

annotations array

テキスト注釈の配列。通常は空の配列です。

summary array

推論サマリーの配列。このフィールドは、typereasoning の場合にのみ存在します。各要素には、値が summary_texttype フィールドと、サマリーテキストを含む text フィールドが含まれます。

action object

検索アクション情報。このフィールドは、typeweb_search_call の場合にのみ存在します。

プロパティ

query string

検索クエリキーワード。

type string

検索タイプ。値は search です。

sources array

検索ソースのリスト。各要素には type フィールドと url フィールドが含まれます。

code string

モデルによって生成および実行されるコード。このフィールドは、typecode_interpreter_call の場合にのみ存在します。

outputs array

コード実行出力の配列。このフィールドは、typecode_interpreter_call の場合にのみ存在します。各要素には、値が logstype フィールドと、コード実行ログを含む logs フィールドが含まれます。

container_id string

コードインタープリターコンテナーの識別子。このフィールドは、typecode_interpreter_call の場合にのみ存在します。同じセッション内の複数のコード実行を関連付けるために使用されます。

goal string

ウェブページからどの情報を抽出する必要があるかを説明する抽出目標の説明。このフィールドは、typeweb_extractor_call の場合にのみ存在します。

output string

ツール呼び出しの出力結果 (文字列形式)。

  • typeweb_extractor_call の場合、これは抽出されたウェブコンテンツの要約です。

  • typeweb_search_image_call または image_search_call の場合、これは画像検索結果の配列を含む JSON 文字列です。各要素には title フィールド (画像タイトル)、url フィールド (画像 URL)、および index フィールド (シーケンス番号) が含まれます。

  • typemcp_call の場合、これは MCP サービスから返された JSON 文字列の結果です。

urls array

抽出されたウェブページの URL のリスト。このフィールドは、typeweb_extractor_call の場合にのみ存在します。

server_label string

MCP サービスラベル。このフィールドは、typemcp_call の場合にのみ存在します。この呼び出しに使用された MCP サービスを識別します。

queries array

ナレッジベース取得に使用されたクエリのリスト。このフィールドは、typefile_search_call の場合にのみ存在します。配列要素は、モデルによって生成された検索クエリを表す文字列です。

results array

ナレッジベース取得結果の配列。このフィールドは、typefile_search_call の場合にのみ存在します。

配列要素のプロパティ

file_id string

一致するドキュメントのファイル ID。

filename string

一致するドキュメントのファイル名。

score float

一致の関連性スコア (0 から 1 の範囲)。値が高いほど関連性が高いことを示します。

text string

一致したドキュメントコンテンツのスニペット。

usage object

このリクエストのトークン消費情報。

プロパティ

input_tokens integer

入力トークンの数。

output_tokens integer

モデルによって出力されるトークンの数。

total_tokens integer

消費された合計トークン数。これは input_tokens と output_tokens の合計です。

input_tokens_details object

入力トークンの詳細な分類。

プロパティ

cached_tokens integer

キャッシュにヒットしたトークンの数。詳細については、「コンテキストキャッシュ」をご参照ください。

output_tokens_details object

出力トークンの詳細な分類。

プロパティ

reasoning_tokens integer

思考プロセスにおけるトークンの数。

x_details object

プロパティ

input_tokens integer

入力トークンの数。

output_tokens integer

モデルによって出力されるトークンの数。

total_tokens integer

消費された合計トークン数。これは input_tokens と output_tokens の合計です。

x_billing_type string

値は response_api です。

x_tools object

ツール使用に関する統計情報。組み込みツールが使用された場合、このフィールドには各ツールの呼び出し回数が含まれます。

例:{"web_search": {"count": 1}}

error object

モデルが応答の生成に失敗した場合に返されるエラーオブジェクト。成功時にはこのフィールドは null です。

tools array

エコー要求からの tools パラメーターの完全な内容。構造はリクエストボディの tools パラメーターと同じです。

tool_choice string

エコー要求からの tool_choice パラメーターの値。有効な値は autonone、および required です。

レスポンスチャンクオブジェクト (ストリーミング出力)

基本的な呼び出し

// response.created - 応答作成
{"response":{"id":"428c90e9-9cd6-90a6-9726-c02b08ebexxx","created_at":1769082930,"object":"response","status":"queued",...},"sequence_number":0,"type":"response.created"}

// response.in_progress - 応答処理中
{"response":{"id":"428c90e9-9cd6-90a6-9726-c02b08ebexxx","status":"in_progress",...},"sequence_number":1,"type":"response.in_progress"}

// response.output_item.added - 新しい出力項目追加
{"item":{"id":"msg_bcb45d66-fc34-46a2-bb56-714a51e8exxx","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":2,"type":"response.output_item.added"}

// response.content_part.added - 新しいコンテンツブロック追加
{"content_index":0,"item_id":"msg_bcb45d66-fc34-46a2-bb56-714a51e8exxx","output_index":0,"part":{"annotations":[],"text":"","type":"output_text","logprobs":null},"sequence_number":3,"type":"response.content_part.added"}

// response.output_text.delta - 増分テキスト (複数回トリガー)
{"content_index":0,"delta":"人工知能","item_id":"msg_bcb45d66-fc34-46a2-bb56-714a51e8exxx","logprobs":[],"output_index":0,"sequence_number":4,"type":"response.output_text.delta"}
{"content_index":0,"delta":"(AI) とは、コンピューターシステムによって人間の知的行動をシミュレートする技術と科学を指します","item_id":"msg_bcb45d66-fc34-46a2-bb56-714a51e8exxx","logprobs":[],"output_index":0,"sequence_number":6,"type":"response.output_text.delta"}

// response.output_text.done - テキスト完了
{"content_index":0,"item_id":"msg_bcb45d66-fc34-46a2-bb56-714a51e8exxx","logprobs":[],"output_index":0,"sequence_number":53,"text":"人工知能 (AI) とは、コンピューターシステムによって人間の知的行動をシミュレートする技術と科学を指します...","type":"response.output_text.done"}

// response.content_part.done - コンテンツブロック完了
{"content_index":0,"item_id":"msg_bcb45d66-fc34-46a2-bb56-714a51e8exxx","output_index":0,"part":{"annotations":[],"text":"...全文...","type":"output_text","logprobs":null},"sequence_number":54,"type":"response.content_part.done"}

// response.output_item.done - 出力項目完了
{"item":{"id":"msg_bcb45d66-fc34-46a2-bb56-714a51e8exxx","content":[{"annotations":[],"text":"...全文...","type":"output_text","logprobs":null}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":55,"type":"response.output_item.done"}

// response.completed - 応答完了 (完全な応答と使用量を含む)
{"response":{"id":"428c90e9-9cd6-90a6-9726-c02b08ebexxx","created_at":1769082930,"model":"qwen3-max-2026-01-23","object":"response","output":[...],"status":"completed","usage":{"input_tokens":37,"output_tokens":243,"total_tokens":280,...}},"sequence_number":56,"type":"response.completed"}

Webスクレイピング

id:1
event:response.created
:HTTP_STATUS/200
data:{"sequence_number":0,"type":"response.created","response":{"output":[],"parallel_tool_calls":false,"created_at":1769435906,"tool_choice":"auto","model":"","id":"863df8d9-cb29-4239-a54f-3e15a2427xxx","tools":[],"object":"response","status":"queued"}}

id:2
event:response.in_progress
:HTTP_STATUS/200
data:{"sequence_number":1,"type":"response.in_progress","response":{"output":[],"parallel_tool_calls":false,"created_at":1769435906,"tool_choice":"auto","model":"","id":"863df8d9-cb29-4239-a54f-3e15a2427xxx","tools":[],"object":"response","status":"in_progress"}}

id:3
event:response.output_item.added
:HTTP_STATUS/200
data:{"sequence_number":2,"item":{"summary":[],"type":"reasoning","id":"msg_5bd0c6df-19b8-4a04-bc00-8042a224exxx"},"output_index":0,"type":"response.output_item.added"}

id:4
event:response.reasoning_summary_text.delta
:HTTP_STATUS/200
data:{"delta":"ユーザーは私に次のことを求めています:\n1. Alibaba Cloud の公式サイトを検索する。\n2. ホームページから主要な情報を抽出する。\n\nまず Alibaba Cloud のウェブサイトの URL を検索し、次に web_extractor ツールを使用してサイトにアクセスし、主要な情報を抽出する必要があります。","sequence_number":3,"output_index":0,"type":"response.reasoning_summary_text.delta","item_id":"msg_5bd0c6df-19b8-4a04-bc00-8042a224exxx","summary_index":0}

id:14
event:response.reasoning_summary_text.done
:HTTP_STATUS/200
data:{"sequence_number":13,"text":"ユーザーは私に次のことを求めています:\n1. Alibaba Cloud の公式サイトを検索する。\n2. ホームページから主要な情報を抽出する。\n\nまず Alibaba Cloud のウェブサイトの URL を検索し、次に web_extractor ツールを使用してサイトにアクセスし、主要な情報を抽出する必要があります。","output_index":0,"type":"response.reasoning_summary_text.done","item_id":"msg_5bd0c6df-19b8-4a04-bc00-8042a224exxx","summary_index":0}

id:15
event:response.output_item.done
:HTTP_STATUS/200
data:{"sequence_number":14,"item":{"summary":[{"type":"summary_text","text":"ユーザーは私に次のことを求めています:\n1. Alibaba Cloud の公式サイトを検索する。\n2. ホームページから主要な情報を抽出する。\n\nまず Alibaba Cloud のウェブサイトの URL を検索し、次に web_extractor ツールを使用してサイトにアクセスし、主要な情報を抽出する必要があります。"}],"type":"reasoning","id":"msg_5bd0c6df-19b8-4a04-bc00-8042a224exxx"},"output_index":1,"type":"response.output_item.done"}

id:16
event:response.output_item.added
:HTTP_STATUS/200
data:{"sequence_number":15,"item":{"action":{"type":"search","query":"Web search"},"id":"msg_a8a686b1-0a57-40e1-bb55-049a89cd4xxx","type":"web_search_call","status":"in_progress"},"output_index":1,"type":"response.output_item.added"}

id:17
event:response.web_search_call.in_progress
:HTTP_STATUS/200
data:{"sequence_number":16,"output_index":1,"type":"response.web_search_call.in_progress","item_id":"msg_a8a686b1-0a57-40e1-bb55-049a89cd4xxx"}

id:19
event:response.web_search_call.completed
:HTTP_STATUS/200
data:{"sequence_number":18,"output_index":1,"type":"response.web_search_call.completed","item_id":"msg_a8a686b1-0a57-40e1-bb55-049a89cd4xxx"}

id:20
event:response.output_item.done
:HTTP_STATUS/200
data:{"sequence_number":19,"item":{"action":{"sources":[{"type":"url","url":"https://cn.aliyun.com/"},{"type":"url","url":"https://www.aliyun.com/"}],"type":"search","query":"Web search"},"id":"msg_a8a686b1-0a57-40e1-bb55-049a89cd4xxx","type":"web_search_call","status":"completed"},"output_index":1,"type":"response.output_item.done"}

id:33
event:response.output_item.added
:HTTP_STATUS/200
data:{"sequence_number":32,"item":{"urls":["https://cn.aliyun.com/"],"goal":"Alibaba Cloud のホームページから、会社のポジショニング/プロファイル、コア製品とサービス、主要な事業セクション、特別な機能/ソリューション、最新ニュース/イベント、無料トライアル/プロモーション情報、ナビゲーションメニュー構造など、主要な情報を抽出する。","id":"msg_8c2cf651-48a5-460c-aa7a-bea5b09b4xxx","type":"web_extractor_call","status":"in_progress"},"output_index":3,"type":"response.output_item.added"}

id:34
event:response.output_item.done
:HTTP_STATUS/200
data:{"sequence_number":33,"item":{"output":"https://cn.aliyun.com/ の有用な情報は、ユーザーの目標「Alibaba Cloud のホームページから、会社のポジショニング/プロファイル、コア製品とサービス、主要な事業セクション、特別な機能/ソリューション、最新ニュース/イベント、無料トライアル/プロモーション情報、ナビゲーションメニュー構造など、主要な情報を抽出する」に対して次の通りです:\n\nページ内の証拠:\n## 通義大規模モデル、企業が AI 時代を受け入れるための最初の選択肢\n\n## 企業の技術革新のクラウドを創造するための完全な製品システム\n\nすべてのクラウド製品## 大規模モデルとクラウドコンピューティングの協調開発に依存して AI を手の届くものにする\n\nすべての AI ソリューション\n\n要約:\nAlibaba Cloud は、通義大規模モデルを中心とした主要な企業向け AI ソリューションプロバイダーとして位置づけられています...","urls":["https://cn.aliyun.com/"],"goal":"Alibaba Cloud のホームページから、会社のポジショニング/プロファイル、コア製品とサービス、主要な事業セクション、特別な機能/ソリューション、最新ニュース/イベント、無料トライアル/プロモーション情報、ナビゲーションメニュー構造など、主要な情報を抽出する。","id":"msg_8c2cf651-48a5-460c-aa7a-bea5b09b4xxx","type":"web_extractor_call","status":"completed"},"output_index":3,"type":"response.output_item.done"}

id:50
event:response.output_item.added
:HTTP_STATUS/200
data:{"sequence_number":50,"item":{"content":[{"type":"text","text":""}],"type":"message","id":"msg_final","role":"assistant"},"output_index":5,"type":"response.output_item.added"}

id:51
event:response.output_text.delta
:HTTP_STATUS/200
data:{"delta":"Alibaba Cloud の公式サイトを見つけ、ホームページから主要な情報を抽出しました:\n\n","sequence_number":51,"output_index":5,"type":"response.output_text.delta"}

id:60
event:response.completed
:HTTP_STATUS/200
data:{"type":"response.completed","response":{"id":"863df8d9-cb29-4239-a54f-3e15a2427xxx","status":"completed","usage":{"input_tokens":45,"output_tokens":320,"total_tokens":365}}}

テキストからの画像検索

// 1. response.created - 応答作成
id:1
event:response.created
data:{"sequence_number":0,"type":"response.created","response":{"output":[],"status":"queued",...}}

// 2. response.in_progress - 応答処理中
id:2
event:response.in_progress
data:{"sequence_number":1,"type":"response.in_progress","response":{"status":"in_progress",...}}

// 3. response.output_item.added - 推論開始 (reasoning)
id:3
event:response.output_item.added
data:{"sequence_number":2,"item":{"summary":[],"type":"reasoning","id":"msg_xxx"},"output_index":0,"type":"response.output_item.added"}

// 4. response.reasoning_summary_text.delta - 推論サマリーの差分
id:4
event:response.reasoning_summary_text.delta
data:{"delta":"ユーザーは猫の画像を探しています。web_search_image ツールを使って検索する必要があります...","sequence_number":3,"output_index":0,"type":"response.reasoning_summary_text.delta","item_id":"msg_xxx","summary_index":0}

// 5. response.reasoning_summary_text.done - 推論サマリー完了
id:10
event:response.reasoning_summary_text.done
data:{"sequence_number":9,"text":"ユーザーは猫の画像を探しています。web_search_image ツールを使って猫の画像を検索する必要があります。","output_index":0,"type":"response.reasoning_summary_text.done","item_id":"msg_xxx","summary_index":0}

// 6. response.output_item.done - 推論項目完了
id:11
event:response.output_item.done
data:{"sequence_number":10,"item":{"summary":[{"type":"summary_text","text":"..."}],"type":"reasoning","id":"msg_xxx"},"output_index":0,"type":"response.output_item.done"}

// 7. response.output_item.added - テキストからの画像検索ツール呼び出し開始 (status: in_progress, name と arguments を含む)
id:12
event:response.output_item.added
data:{"sequence_number":11,"item":{"name":"web_search_image","arguments":"{\"queries\": [\"cat picture\", \"cute cat\"]}","id":"msg_xxx","type":"web_search_image_call","status":"in_progress"},"output_index":1,"type":"response.output_item.added"}

// 8. response.output_item.done - テキストからの画像検索ツール呼び出し完了 (完全な出力検索結果を含む)
id:13
event:response.output_item.done
data:{"sequence_number":12,"item":{"name":"web_search_image","output":"[{\"title\": \"Cute kitten...\", \"url\": \"https://example.com/cat.jpg\", \"index\": 1}, ...]","arguments":"{\"queries\": [\"cat picture\", \"cute cat\"]}","id":"msg_xxx","type":"web_search_image_call","status":"completed"},"output_index":1,"type":"response.output_item.done"}

// 9-12. 2回目の推論 + 最終メッセージ出力 (基本的な呼び出しと同じ)
// response.output_item.added (reasoning) → reasoning_summary_text.delta/done → response.output_item.done (reasoning)
// response.output_item.added (message) → response.content_part.added → response.output_text.delta → response.output_text.done → response.content_part.done → response.output_item.done (message)

// 13. response.completed - 応答完了
id:118
event:response.completed
data:{"sequence_number":117,"type":"response.completed","response":{"output":[...],"status":"completed","usage":{"input_tokens":7895,"output_tokens":318,"total_tokens":8213,"x_tools":{"web_search_image":{"count":1}}}}}

画像検索

// 1-6. 推論フェーズ (テキストからの画像検索と同じ)

// 7. response.output_item.added - 画像検索ツール呼び出し開始
// 注:arguments には img_idx (画像インデックス) と bbox (検索エリアのバウンディングボックス) が含まれます
id:29
event:response.output_item.added
data:{"sequence_number":29,"item":{"name":"image_search","arguments":"{\"img_idx\": 0, \"bbox\": [0, 0, 1000, 1000]}","id":"msg_xxx","type":"image_search_call","status":"in_progress"},"output_index":1,"type":"response.output_item.added"}

// 8. response.output_item.done - 画像検索ツール呼び出し完了
id:30
event:response.output_item.done
data:{"sequence_number":30,"item":{"name":"image_search","output":"[{\"title\": \"Landscape background...\", \"url\": \"https://example.com/landscape.jpg\", \"index\": 1}, ...]","arguments":"{\"img_idx\": 0, \"bbox\": [0, 0, 1000, 1000]}","id":"msg_xxx","type":"image_search_call","status":"completed"},"output_index":1,"type":"response.output_item.done"}

// 9-12. 2回目の推論 + 最終メッセージ出力 (基本的な呼び出しと同じ)

// 13. response.completed
id:408
event:response.completed
data:{"sequence_number":407,"type":"response.completed","response":{"output":[...],"status":"completed","usage":{"input_tokens":8371,"output_tokens":417,"total_tokens":8788,"x_tools":{"image_search":{"count":1}}}}}

MCP

// 1-6. 推論フェーズ (他のツールと同じ)

// 7. response.mcp_call_arguments.delta - MCP 引数の差分 (MCP 固有のイベント)
id:27
event:response.mcp_call_arguments.delta
data:{"delta":"{\"city\": \"Beijing\"}","sequence_number":26,"output_index":1,"type":"response.mcp_call_arguments.delta","item_id":"msg_xxx"}

// 8. response.mcp_call_arguments.done - MCP 引数完了 (MCP 固有のイベント)
id:28
event:response.mcp_call_arguments.done
data:{"sequence_number":27,"arguments":"{\"city\": \"Beijing\"}","output_index":1,"type":"response.mcp_call_arguments.done","item_id":"msg_xxx"}

// 9. response.output_item.added - MCP ツール呼び出し開始 (name, server_label, arguments を含む)
id:29
event:response.output_item.added
data:{"sequence_number":28,"item":{"name":"amap-maps-maps_weather","server_label":"MCP Server","arguments":"{\"city\": \"Beijing\"}","id":"msg_xxx","type":"mcp_call","status":"in_progress"},"output_index":1,"type":"response.output_item.added"}

// 10. response.mcp_call.completed - MCP 呼び出し完了 (MCP 固有のイベント)
id:30
event:response.mcp_call.completed
data:{"sequence_number":29,"output_index":1,"type":"response.mcp_call.completed","item_id":"msg_xxx"}

// 11. response.output_item.done - MCP 出力項目完了 (完全な出力を含む)
id:31
event:response.output_item.done
data:{"sequence_number":30,"item":{"output":"{\"city\":\"Beijing\",\"forecasts\":[...]}","name":"amap-maps-maps_weather","server_label":"MCP Server","arguments":"{\"city\": \"Beijing\"}","id":"msg_xxx","type":"mcp_call","status":"completed"},"output_index":1,"type":"response.output_item.done"}

// 12-15. 2回目の推論 + 最終メッセージ出力

// 16. response.completed
id:172
event:response.completed
data:{"sequence_number":171,"type":"response.completed","response":{"output":[...],"status":"completed","usage":{"input_tokens":5019,"output_tokens":539,"total_tokens":5558}}}

ナレッジベース検索

// 1-6. 推論フェーズ (他のツールと同じ)

// 7. response.output_item.added - ナレッジベース検索開始 (queries を含むが results はなし)
id:19
event:response.output_item.added
data:{"sequence_number":18,"item":{"id":"msg_xxx","type":"file_search_call","queries":["Alibaba Cloud Bailian X1 phone","Alibaba Cloud Bailian X1 phone","Bailian X1"],"status":"in_progress"},"output_index":1,"type":"response.output_item.added"}

// 8. response.file_search_call.in_progress - 検索中 (file_search 固有のイベント)
id:20
event:response.file_search_call.in_progress
data:{"sequence_number":19,"output_index":1,"type":"response.file_search_call.in_progress","item_id":"msg_xxx"}

// 9. response.file_search_call.searching - 検索中 (file_search 固有のイベント)
id:21
event:response.file_search_call.searching
data:{"sequence_number":20,"output_index":1,"type":"response.file_search_call.searching","item_id":"msg_xxx"}

// 10. response.file_search_call.completed - 検索完了 (file_search 固有のイベント)
id:22
event:response.file_search_call.completed
data:{"sequence_number":21,"output_index":1,"type":"response.file_search_call.completed","item_id":"msg_xxx"}

// 11. response.output_item.done - 出力項目完了 (queries + results を含む)
id:23
event:response.output_item.done
data:{"sequence_number":22,"item":{"id":"msg_xxx","type":"file_search_call","queries":["Alibaba Cloud Bailian X1 phone","Alibaba Cloud Bailian X1 phone","Bailian X1"],"results":[{"score":0.7519,"filename":"Introduction to Alibaba Cloud Bailian Series Phones","text":"Alibaba Cloud Bailian X1 — Enjoy an ultimate visual experience...","file_id":"file_xxx"}],"status":"completed"},"output_index":1,"type":"response.output_item.done"}

// 12-15. 2回目の推論 + 最終メッセージ出力

// 16. response.completed
id:146
event:response.completed
data:{"sequence_number":145,"type":"response.completed","response":{"output":[...],"status":"completed","usage":{"input_tokens":1576,"output_tokens":722,"total_tokens":2298,"x_tools":{"file_search":{"count":1}}}}}

ストリーミング出力は一連の JSON オブジェクトを返します。各オブジェクトには、イベントタイプを識別するための type フィールドと、イベントの順序を示すための sequence_number フィールドが含まれます。response.completed イベントはストリームの終了を示します。

type string

イベントタイプの識別子。有効な値:

  • response.created:応答が作成されたときにトリガーされます。ステータスは queued です。

  • response.in_progress:応答処理が開始されたときにトリガーされます。ステータスは in_progress に変わります。

  • response.output_item.added:メッセージや web_extractor_call などの新しい出力項目が出力配列に追加されたときにトリガーされます。item.typeweb_extractor_call の場合、これはウェブ抽出ツール呼び出しが開始されたことを示します。

  • response.content_part.added:新しいコンテンツブロックが出力項目のコンテンツ配列に追加されたときにトリガーされます。

  • response.output_text.delta:増分テキスト生成のためにトリガーされます。このイベントは複数回トリガーされ、delta フィールドには新しいテキストの断片が含まれます。

  • response.output_text.done:テキスト生成が完了したときにトリガーされます。text フィールドには完全なテキストが含まれます。

  • response.content_part.done:コンテンツブロックが完了したときにトリガーされます。part オブジェクトには完全なコンテンツブロックが含まれます。

  • response.output_item.done:出力項目が完全に生成されたときにトリガーされます。item オブジェクトには完全な出力項目が含まれます。item.typeweb_extractor_call の場合、これはウェブ抽出ツール呼び出しが完了したことを示します。

  • response.reasoning_summary_text.delta:(思考モードが有効な場合) 推論サマリーの増分テキスト。delta フィールドには新しいサマリーの断片が含まれます。

  • response.reasoning_summary_text.done:(思考モードが有効な場合) 推論サマリーが完了しました。text フィールドには完全なサマリーが含まれます。

  • response.web_search_call.in_progress / searching / completed:(web_search ツールを使用する場合) 検索ステータス変更イベント。

  • response.code_interpreter_call.in_progress / interpreting / completed:(code_interpreter ツールを使用する場合) コード実行ステータス変更イベント。

  • 注:web_extractor ツールを使用する場合、専用のイベントタイプ識別子はありません。ウェブ抽出ツールの呼び出しは、一般的な response.output_item.added および response.output_item.done イベントを通じて伝達されます。これは、値が web_extractor_callitem.type フィールドによって識別されます。

  • response.mcp_call_arguments.delta / response.mcp_call_arguments.done:(mcp ツールを使用する場合) MCP 呼び出し引数の増分および完了イベント。

  • response.mcp_call.completed:(mcp ツールを使用する場合) MCP サービス呼び出し完了。

  • response.file_search_call.in_progress / searching / completed:(file_search ツールを使用する場合) ナレッジベース検索ステータス変更イベント。

  • 注:web_search_image または image_search ツールを使用する場合、専用の中間状態イベントはありません。ツールの呼び出しは、response.output_item.added (呼び出し開始) および response.output_item.done (呼び出し完了) イベントを通じて伝達されます。

  • response.completed:応答生成が完了したときにトリガーされます。response オブジェクトには、使用量情報を含む完全な応答が含まれます。このイベントはストリームの終了を示します。

sequence_number integer

イベントのシリアル番号。0 から始まり、増分します。これを使用して、クライアントがイベントを正しい順序で処理することを確認できます。

response object

レスポンスオブジェクト。response.createdresponse.in_progress、および response.completed イベントに表示されます。response.completed イベントでは、outputusage を含む完全な応答データが含まれます。その構造は、非ストリーミング応答のレスポンスオブジェクトと一致します。

item object

出力項目オブジェクト。response.output_item.added および response.output_item.done イベントに表示されます。added イベントでは、コンテンツが空の配列である初期スケルトンです。done イベントでは、完全なオブジェクトです。

プロパティ

id string

出力項目の一意の識別子。例:msg_xxx

type string

出力項目のタイプ。有効な値:message (メッセージ)、reasoning (推論)、web_search_call (検索)、web_search_image_call (テキストからの画像検索)、image_search_call (画像検索)、mcp_call (MCP 呼び出し)、および file_search_call (ナレッジベース検索)。

role string

メッセージのロール。値は assistant です。このフィールドは、タイプが message の場合にのみ存在します。

status string

生成ステータス。added イベントでは、ステータスは in_progress です。done イベントでは、ステータスは completed です。

content array

メッセージコンテンツの配列。added イベントでは、空の配列 [] です。done イベントでは、part オブジェクトと同じ構造を持つ完全なコンテンツブロックオブジェクトが含まれます。

part object

コンテンツブロックオブジェクト。response.content_part.added および response.content_part.done イベントに表示されます。

プロパティ

type string

コンテンツブロックタイプ。値は output_text です。

text string

テキストコンテンツ。added イベントでは、空の文字列です。done イベントでは、完全なテキストです。

annotations array

テキスト注釈の配列。通常は空の配列です。

logprobs object | null

トークンの対数確率情報。現在、これは null です。

delta string

増分テキストコンテンツ。response.output_text.delta イベントに表示され、新しいテキストの断片が含まれます。クライアントは、すべての delta 断片を連結して完全なテキストを取得する必要があります。

text string

完全なテキストコンテンツ。response.output_text.done イベントに表示され、コンテンツブロックの完全なテキストが含まれます。これを使用して、連結された delta の結果を検証できます。

item_id string

出力項目の一意の識別子。同じ出力項目に関連するイベントを関連付けるために使用されます。

output_index integer

output 配列内の出力項目のインデックス位置。

content_index integer

content 配列内のコンテンツブロックのインデックス位置。

summary_index integer

サマリー配列のインデックス。response.reasoning_summary_text.delta および response.reasoning_summary_text.done イベントに表示されます。

よくある質問

Q:マルチターン対話のコンテキストを渡す方法は?

A:対話の新しいターンを開始するには、前のモデル応答の idprevious_response_id パラメーターとして渡します。

Q:なぜレスポンス例の一部のフィールドがこのドキュメントで説明されていないのですか?

A:公式の OpenAI SDK を使用すると、独自のモデル構造に基づいて、通常は null の追加フィールドが出力されることがあります。これらのフィールドは OpenAI プロトコルによって定義されていますが、現在当社のサービスではサポートされていません。このドキュメントで説明されているフィールドにのみ注目してください。