MaaS_DB_webSearch
Request Protocol
https
Header
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | string | Yes | application/json |
| Authorization | string | Yes | Bearer ${your_ak} |
Request Body Parameters
| Parameter Name | Secondary Parameters | Three-level parameters | Type | Required | Description |
|---|---|---|---|---|---|
| model | - | - | string | Yes | Doubao Seed 模型 ID / Endpoint ID |
| input | - | - | string 或 array | Yes | User input; can be a string or an array of messages |
| role | - | string | Yes (when it is an array) | system / user / assistant |
|
| content | - | string 或 array | Yes (when it is an array) | Text or multimodal content | |
| - | type | string | No | In multimodal scenarios, it refers to input_textand the like |
|
| - | text | string | No | type= input_texttext at this point |
|
| tools | - | - | array[object] | No | List of available tools; includes when internet access is enabled: web_search |
| type | - | string | Yes | Fixed as web_search |
|
| sources | - | array[string] | No | Content source list: search_engine, toutiao, douyin, moji; if unspecified, it shall be determined by the default policy of the model/platform |
|
| max_keyword | - | integer | No | The maximum number of keywords that a model can initiate within a single search round | |
| limit | - | integer | No | Maximum number of results returned per keyword in a single search; valid value range[1,50], default value 10 |
|
| user_location | - | object | No | Approximate the user's geographic location to optimize local/weather-related searches | |
| - | type | string | No | Location type, e. g. approximate |
|
| - | city | string | No | city | |
| - | country | string | No | country | |
| - | region | string | No | Province/Region |
Request Example
curl --location 'https://genaiapi.cloudsway.net/v1/ai/{YOUR_ENDPOINT}/responses' \
--header 'Authorization: Bearer ${your_ak}' \
--header 'Content-Type: application/json' \
--data '{
"tools": [
{
"type": "web_search",
"max_keyword": 3,
"limit": 20,
"sources": ["search_engine", "toutiao"]
}
],
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "..."
}
]
}
]
}'
Response Example
The response typically contains two types of key output items:
"usage": {
"input_tokens": 1200,
"output_tokens": 800,
"total_tokens": 2000,
"tool_usage": {
"web_search": 2
},
"tool_usage_details": {
"web_search": {
"search_engine": 2,
"toutiao": 2
}
}
}
usageField Description:
| field | Description |
|---|---|
tool_usage.web_search |
Total number of calls to the web_search tool in this round (by keyword dimension) |
tool_usage_details.web_search.{source} |
Number of searches broken down by content source, e. g. search_engine, toutiao |