88API88API
User GuideAI ApplicationsAPI ReferenceHelp & Support
Web Search

DeepSeek Web Search

Let DeepSeek V4.1 Flash search the web for real-time information and cite its sources, using the web_search tool of the Responses API.

📝 Overview

deepseek-v4.1-flash can search the web: the model decides by itself whether to search and which keywords to use, answers from the search results, and attaches source links to the answer. Use it for time-sensitive information such as news, weather, market data and match results.

Web search is enabled with the web_search tool of the Responses API (POST /v1/responses).

Requirements

  • Token group: Deepseek官转
  • Model: deepseek-v4.1-flash
  • Endpoint: POST https://api.88api.ai/v1/responses

💡 Examples

Basic usage ✅

curl https://api.88api.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "tools": [{"type": "web_search"}],
    "input": "What is the weather in Hangzhou today?"
  }'

Python (OpenAI SDK) ✅

from openai import OpenAI

client = OpenAI(base_url="https://api.88api.ai/v1", api_key="sk-your-token")

resp = client.responses.create(
    model="deepseek-v4.1-flash",
    tools=[{"type": "web_search"}],
    input="What is the weather in Hangzhou today?",
)
print(resp.output_text)

Limit keywords and results ✅

curl https://api.88api.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "max_tool_calls": 2,
    "tools": [{
      "type": "web_search",
      "max_keyword": 2,
      "limit": 5,
      "user_location": {"type": "approximate", "country": "China", "region": "Zhejiang", "city": "Hangzhou"}
    }],
    "input": "What is the weather in Hangzhou today?"
  }'

Streaming ✅

Add "stream": true to the request body. Each search emits the following events before the answer text starts:

EventMeaning
response.web_search_call.in_progressA search starts
response.web_search_call.searchingSearching
response.web_search_call.completedThe search is done
response.output_text.deltaAnswer text, chunk by chunk
response.completedFinished; includes usage

📬 Response example

Excerpt; the reasoning items and other fields are omitted:

{
  "object": "response",
  "status": "completed",
  "output": [
    {
      "type": "web_search_call",
      "id": "ws_0217925902513450000...",
      "status": "completed",
      "action": {
        "type": "search",
        "query": "Hangzhou weather today"
      }
    },
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "In Hangzhou the rain stopped this morning and it turned cloudy, with a high of about 21–24°C...",
          "annotations": [
            {
              "type": "url_citation",
              "title": "China Meteorological Administration - City Forecast",
              "url": "https://weather.cma.cn/web/text/HD/AZJ.html",
              "site_name": "中国气象局",
              "publish_time": "2026年10月21日 08:00:00(CST) 星期三"
            }
          ]
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 4320,
    "output_tokens": 418,
    "total_tokens": 4738,
    "tool_usage": {"web_search": 1},
    "tool_usage_details": {"web_search": {"search_engine": 1}}
  }
}
FieldDescription
output[].type = "web_search_call"One search made by the model; action.query holds the keywords, separated by ; when a round uses several
output[].type = "message"The final answer; the text is in output_text.text
annotations[].type = "url_citation"A source cited in the answer: title, link, site name and publish time
usage.tool_usage.web_searchNumber of searches in this request (counted per keyword)

⚙️ Parameters

web_search in tools

ParameterTypeRequiredDescription
typestringYesAlways web_search
max_keywordintegerNoMaximum keywords per search round, 1–50
limitintegerNoMaximum results per search, 1–50, default 10
user_locationobjectNoApproximate user location, improves weather and local questions. Format: {"type": "approximate", "country": "China", "region": "Zhejiang", "city": "Hangzhou"}

Request-level parameters

ParameterTypeRequiredDescription
max_tool_callsintegerNoMaximum search rounds in one answer, 1–10, default 3
streambooleanNoStream the response

Other parameters (such as input, instructions and max_output_tokens) are the same as in OpenAI Responses.

💰 Billing

Cost = model token cost + search cost:

  • Searches are counted per keyword: a round that uses several keywords counts once per keyword, as reported in usage.tool_usage.web_search. No search cost is charged when the model decides not to search.
  • Tokens: the search results are given to the model as input, so input tokens grow noticeably (usually by a few thousand per search) and are charged at the model price.
  • To control the cost, use max_keyword to limit keywords per round and max_tool_calls to limit the number of rounds.

❓ FAQ

Can I use web search with /v1/chat/completions? No. Web search only works on /v1/responses. A web_search tool sent to Chat Completions does not search and is not charged.

Why didn't the model search? The model decides whether a question needs a search. Questions that need no fresh information (math, general knowledge) are answered directly. To make sure it searches, ask for it explicitly, for example "search the web before answering".

Can other groups use it? Currently only deepseek-v4.1-flash in the Deepseek官转 group supports web search.