Search & Fetch API Guide: Endpoints, Parameters, and Billing
As of October 17, DeepSeek exposes its in-house search engine as two raw JSON APIs that give agents and RAG applications live web content. This guide summarizes endpoints, parameters, and billing from the official API docs.
Endpoints and auth
Both share the base URL https://api.deepseek.com and bearer authentication with the chat API:
- Search:
POST /v1/tools/search— structured web results for a query; - Fetch:
POST /v1/tools/fetch— retrieves a single page as Markdown.
Search request parameters
| Field | Type | Required | Notes |
|---|---|---|---|
| query | string | Yes | 1–128 Unicode characters, not all whitespace, query operators supported |
| count | integer | No | Number of results, 1–50, default 10 |
| need_content | boolean | No | Include page content |
| ori_question | string | No | The original question that triggered the search (1–128 chars), improves query understanding |
Results include title, url, and summary (plus content when need_content is true), which fits a search-then-fetch workflow. For working code, see the Python tutorial.
Billing
Each endpoint costs $0.75 per 1,000 successful calls, billed independently. One window worth using: Search/Fetch calls made via server-side tools in DeepSeek Harness, Claude Code, and Codex are free until October 31, 2026, 16:00 UTC. When pairing with a chat model, send result summaries rather than full pages and enable context caching to trim token costs—see API best practices.
Relationship to token billing
Search/Fetch bills per call and is independent of model token prices (deepseek-flash output peaks at $1.20 per million, half off off-peak). If your traffic concentrates in off-peak hours, the model side halves again—rules in the off-peak pricing guide. For tool-side integration options, see the coding agent tools roundup.
大模型网摘