developer tools

DeepSeek Search and Fetch: Live Web Data at $0.75 per 1,000 Requests

DeepSeek Search and Fetch: Live Web Data at $0.75 per 1,000 Requests

An agent—a program that can choose tools and take steps—can produce a polished answer from a page that changed yesterday. How do you give it fresh web information without stitching together a search provider, a page scraper, and a pile of special cases?

DeepSeek’s Search and Fetch application programming interfaces (APIs) offer a smaller path. Search discovers web pages and returns structured results; Fetch retrieves one chosen page and returns its content as Markdown, a plain-text format that preserves headings, links, and other useful structure. The two raw JSON (JavaScript Object Notation) APIs use bearer authentication, meaning your API key travels in an Authorization header. Each standalone endpoint—the specific network address for one operation—costs $0.75 per 1,000 successful requests, or $0.00075 per billable call. (api-docs.deepseek.com)

Search and Fetch are two halves of one workflow

Think of Search as the catalog and Fetch as the page request at the library desk. Search accepts a query and returns ranked candidates. The query must be 1 to 128 Unicode characters, meaning text characters from the world’s writing systems. count defaults to 10 and can be set from 1 to 50. need_content is false by default; turn it on when you want page content included in the search response. An agent can also pass ori_question, the user’s original question that led to the shorter query, so the search engine gets more context.

The query syntax is pleasantly familiar. Use site: to focus on a domain, -site: to exclude one, quotation marks for an exact phrase, lang: for languages, and after: or before: for dates. You can combine operators, which makes a query such as migration guide site:postgresql.org lang:en after:2025 more targeted than a vague search phrase.

Results carry more than a title and a link. Each item can include a snippet for display, a longer summary for a model, optional page content, a publication date, site metadata, a rerank_score from 0 to 3, and an authority tier from -1 to 4. DeepSeek describes scores of 1.5 or higher as high-quality results and authority values of 3 or higher as highly authoritative. Those are useful signals, not a replacement for checking whether the source actually fits your task.

A small Python pipeline

The following example uses requests, a Python library for making HTTP calls. It searches first, then fetches only the selected page. Keeping the two stages visible makes it easier to add domain filters, caching, or approval rules later.

import os
import requests

api_key = os.environ['DEEPSEEK_API_KEY']
base_url = 'https://api.deepseek.com'
headers = {
 'Authorization': f'Bearer {api_key}',
 'Content-Type': 'application/json',
}

search = requests.post(
 f'{base_url}/v1/tools/search',
 headers=headers,
 json={
 'query': 'database migration guide site:postgresql.org lang:en',
 'count': 5,
 'need_content': False,
 'ori_question': 'How should I plan a safe database migration?',
 },
 timeout=30,
)
search.raise_for_status
results = search.json['results']

if not results:
 raise RuntimeError('No matching pages')

chosen = results[0]
fetch = requests.post(
 f'{base_url}/v1/tools/fetch',
 headers=headers,
 json={'url': chosen['url']},
 timeout=30,
)
fetch.raise_for_status

page = fetch.json
print(page['title'])
print(page['content'])

The first result is a reasonable demonstration because Search returns ranked results. In a production agent, inspect the domain, date, authority, and content before handing a page to a model. A page can be relevant and still be wrong for your audience.

Fetch turns a web address into usable text

Fetch has one required field: url, a web address. It accepts an HTTP or HTTPS address up to 8,192 characters long, with a host and without an embedded username or password. On success, the response contains a title and the page body as Markdown. That format is handy for retrieval-augmented generation, or RAG: retrieve source material first, then give selected material to a model that generates an answer. (api-docs.deepseek.com)

You can also set need_content to true during Search and receive content alongside each result. That is convenient for small experiments, but the two-step pattern is often easier to control. Search broadly, compare metadata, then fetch only the pages you intend to read. It keeps irrelevant page text out of your model context, the portion of information the model can consider for one request.

The billing model is easy to calculate

DeepSeek bills Search and Fetch per successful request, not by model tokens—the small text units used for model billing—and not by the number of results in a response. A search that returns five results and a search that returns fifty both count as one Search request. Empty searches, failed calls, and timeouts are not billed; a Fetch call is billable only when it returns page content.

That makes the arithmetic concrete. Suppose 1,000 workflows each make one successful Search call and one successful Fetch call. That is 2,000 successful requests, or $1.50 at the listed rate. If a search returns no results, it does not add a billable Search call.

There is one date-sensitive exception worth separating from the standalone API price. DeepSeek’s pricing page says server-side Search and Fetch calls made through DeepSeek Harness, Claude Code, or Codex are currently free, with per-request billing scheduled to begin at 00:00 Beijing time on November 1, 2026. Direct calls to the raw endpoints remain governed by the per-request pricing above.

Design for the web’s rough edges

Search and Fetch are read-only, but the web is not tidy. A page may disappear, block automated access, expose an unsupported content type, or contain no extractable Markdown. DeepSeek documents separate 5 QPS limits for Search and Fetch, where QPS means requests per second; the limits apply at the account level, and Fetch also has an additional per-domain limit.

For transient HTTP errors—HTTP is the protocol used for web requests—such as status 408, 429, or 5xx, retry with backoff, waiting a little longer after each attempt. A 402 means the account needs more balance. Other 4xx responses usually require a changed request rather than another identical retry. In practice, a queue, a small concurrency cap, URL deduplication, and a cache—a saved copy of earlier content—will protect both your budget and the sites you are reading.

Treat fetched text as untrusted input. Web pages can contain prompt injection, which is text designed to manipulate a model into ignoring your application’s instructions. Keep page content separate from system instructions, limit how much text enters the prompt, and preserve the source URL and title beside the extracted passage so your application can audit where an answer came from.

The core pattern is compact: query, inspect metadata, fetch a chosen page, then give the evidence to the model. At $0.75 per 1,000 successful calls, DeepSeek’s Search and Fetch API makes live-web retrieval predictable enough for small agents and RAG prototypes, while leaving the important judgment—whether a source deserves trust—with your application.

ahsan

ahsan

Hello! I am Mr Ahsan, the writer of the Website. I am from Netherland. I like to write about technology and the news around it.

Comments (0)

No comments yet. Be the first to respond!

Leave a Comment

Your comment will be visible after review.