DeepSeek web search and fetch
Choose direct search, page retrieval, or model-operated web tools to generate an answer.
Choose a calling method
| Need | Method |
|---|---|
| Find pages by keyword and process results yourself | Search returns links, summaries, and optional content; no model is needed |
| Read content from a known URL | Fetch returns the page title and Markdown content; no model is needed |
| Have a model research and answer directly | Declare server-side web tools through Responses or Messages; the model chooses and executes operations |
The following requests use a platform API Key. Both standalone endpoints and model tools may incur charges.
Search and fetch directly
1. Search the web
curl 'https://api.agtcloud.cn/v1/tools/search' \
-H 'Authorization: Bearer your-api-key' \
-H 'Content-Type: application/json' \
--data '{
"query": "DeepSeek site:api-docs.deepseek.com",
"count": 5,
"need_content": false
}'Choose a relevant page from results and read its url. If no results match, adjust the query or scope. Set need_content: true to include page content in search results.
2. Fetch the selected page
Replace the URL below with the results[].url selected in the previous step:
curl 'https://api.agtcloud.cn/v1/tools/fetch' \
-H 'Authorization: Bearer your-api-key' \
-H 'Content-Type: application/json' \
--data '{
"url": "https://example.com/"
}'Read title and content; use the Markdown for display, retrieval, or subsequent model input. Each successful search and fetch is billed separately. Multiple search results still count as one search request.
Let a model use web tools
Replace MODEL_ID with the full ID of a model supporting the corresponding tool. Tools run on the server; the client need not perform searches or send tool results back.
Choose deepseek-v4-pro. web_search supports searching and opening pages; no separate Fetch tool declaration is needed.
curl 'https://api.agtcloud.cn/v1/responses' \
-H 'Authorization: Bearer your-api-key' \
-H 'Content-Type: application/json' \
--data '{
"model": "MODEL_ID",
"reasoning": {"effort": "none"},
"max_output_tokens": 4096,
"tools": [{"type": "web_search"}],
"input": "Search the official Python website, read relevant pages, briefly describe its purpose, and provide source links."
}'For complete request and response structures, see Responses and Messages.
Read results and usage
| Method | Location and meaning |
|---|---|
| Standalone Search / Fetch | Read results for Search and title/content for Fetch; no additional usage is returned |
| Responses results | web_search_call in output describes web operations; the final answer is in the message text |
| Responses usage | usage.server_tool_use.tool_search counts successful search queries; one tool call with multiple queries may count more than once. tool_fetch counts successful page reads, including opening pages and finding text within them. server_tool_use is omitted when both counts are zero |
| Messages results | content contains server_tool_use, web_search_tool_result, and final-answer text blocks |
| Messages usage | usage.server_tool_use.web_search_requests counts attempts, which may include failures or attempts exceeding max_uses. tool_search counts successful searches with results; the platform charges search fees by the successful count |
| Streaming usage | For Responses, read response.usage from the final response.completed/incomplete/failed event. For Messages, read cumulative values from the last message_delta.usage; do not add them to the initial event |
Declaring a tool does not guarantee the model will search; use the returned usage counts. Responses ignores max_tool_calls, and a requested count in the prompt is not a billing cap.