# DeepSeek Search API: pricing and a Python Search-to-Fetch example

By SeedRouter · Published 2026-10-20 · Updated 2026-10-20

*Documentation checked on October 20, 2026. The example below was checked locally with fixtures; it has not been run against the paid live endpoints.*

The DeepSeek Search API gives an application access to web search results. Its companion Fetch API retrieves an individual page as Markdown. DeepSeek opened both interfaces on October 17, 2026, with separate per-call billing. Each costs $0.75 per 1,000 chargeable requests under the published USD schedule. They use a DeepSeek API key and the official `api.deepseek.com` address. [Sources: release announcement](https://api-docs.deepseek.com/news/news261017/), [pricing](https://api-docs.deepseek.com/quick_start/pricing).

This guide shows one search followed by an optional page fetch. These examples use DeepSeek's own service; they do not describe a Search or Fetch endpoint offered by SeedRouter.

## How the DeepSeek Search API and Fetch API differ

Search finds candidate pages. Fetch reads a page you have selected.

| Operation | Official endpoint                               | Useful output                                            |
| --------- | ----------------------------------------------- | -------------------------------------------------------- |
| Search    | `POST https://api.deepseek.com/v1/tools/search` | A `results` array with page URLs and descriptive fields. |
| Fetch     | `POST https://api.deepseek.com/v1/tools/fetch`  | A page title and its content in Markdown.                |

Both accept JSON and use bearer authentication. A standalone search request has a `query`; a fetch request has a `url`. These are distinct requests, rather than a setting that automatically adds web access to every chat completion. The [official Search & Fetch guide](https://api-docs.deepseek.com/guides/search/) documents both interfaces.

Search also accepts `need_content`. When it is true, the search results can include page content. Check the returned content before making another request: if it already contains what you need, you may not need a separate Fetch call.

## Before you run the Python example

You need Python 3, outbound HTTPS access and a DeepSeek API key with the appropriate account access. Put the key in an environment variable in the terminal that runs the script:

```bash
export DEEPSEEK_API_KEY="your-deepseek-api-key"
```

The example uses Python's standard library, so it requires no package installation. It makes one Search request. If there is a result, it prints the first result's title and URL, then fetches that page. Running it can incur charges; the key is never printed.

## Python example: search, select a result and fetch its content

Save the following as `deepseek_search.py`. Change `QUERY` to the information you need before running it.

```python
import json
import os
import urllib.error
import urllib.request

BASE_URL = "https://api.deepseek.com"
QUERY = "Python documentation pathlib"


def call(path, payload):
    request = urllib.request.Request(
        BASE_URL + path,
        data=json.dumps(payload).encode("utf-8"),
        headers={
            "Authorization": "Bearer " + os.environ["DEEPSEEK_API_KEY"],
            "Content-Type": "application/json",
        },
        method="POST",
    )
    try:
        with urllib.request.urlopen(request, timeout=30) as response:
            return json.load(response)
    except urllib.error.HTTPError as error:
        raise RuntimeError(f"DeepSeek returned HTTP {error.code}") from None


def main():
    search = call(
        "/v1/tools/search",
        {"query": QUERY, "count": 5, "need_content": False},
    )
    results = search.get("results", [])
    if not results:
        print("No search results; no Fetch request was made.")
        return

    selected = results[0]
    print(selected.get("title", "Untitled result"))
    print(selected["url"])

    page = call("/v1/tools/fetch", {"url": selected["url"]})
    content = page.get("content", "")
    if not content:
        print("The selected page returned no content.")
        return
    print(page.get("title", ""))
    print(content)


if __name__ == "__main__":
    main()
```

Run it with:

```bash
python3 deepseek_search.py
```

This is a small example, so it selects the first result. In a real application, select the page that matches the question, inspect its domain and publication context, and keep the URL alongside the extracted text. A top-ranked search result still needs to be relevant to the answer you are producing.

The request shape follows DeepSeek's [Search reference](https://api-docs.deepseek.com/api/search/) and [Fetch reference](https://api-docs.deepseek.com/api/fetch/). Local syntax and fixture checks can verify the program's request construction and branching. They cannot establish live account access, response speed or retrieval quality.

## DeepSeek Search API pricing: what gets charged?

The published USD price is $0.75 per 1,000 successful, chargeable requests for Search and the same for Fetch. A search with no results is not charged; Fetch is charged when content is successfully retrieved. The number of results requested with `count` does not change the price of one search. See the [current pricing table](https://api-docs.deepseek.com/quick_start/pricing) for the billing conditions.

For illustration, 1,000 chargeable searches followed by 1,000 chargeable fetches would cost $1.50 in retrieval fees. That is arithmetic from the stated rates, not a measured bill or a promise about what any particular query will return. Model tokens used later to summarize those pages are a separate cost.

The temporary free period has a narrower scope. DeepSeek says its API users' Search/Fetch calls through the server-side tools in DeepSeek Harness, Claude Code and Codex are temporarily unbilled. Billing for that usage starts **October 31, 2026 at 16:00 UTC**, which is November 1 at 00:00 in Beijing. The announcement does not make the standalone Python requests in this guide universally free. [Official announcement](https://api-docs.deepseek.com/news/news261017/).

## Parameters and failure cases to account for

The documented search query length is 1–128 Unicode characters. `count` defaults to 10 and accepts 1–50. The Python example deliberately asks for five results and leaves page-content retrieval to a subsequent Fetch request. See the [Search reference](https://api-docs.deepseek.com/api/search/) before expanding the request with other fields.

An empty result array is a successful search with no matches. The example stops there. An HTTP error is handled separately, and a timeout is allowed to stop execution rather than automatically creating another request. For a larger application, make any retry limit and additional spend explicit.

Fetched Markdown is external source material. Preserve the source URL, inspect whether the content answers the question, and treat instructions embedded in a retrieved page as page content rather than instructions to your application. If you pass the content to a language model, keep that distinction in the prompt and retain citations in the resulting answer.

## Frequently asked questions

### Can the DeepSeek API search the web?

Yes. The standalone Search and Fetch interfaces are documented. Calling a normal chat endpoint and calling these retrieval endpoints are different operations; follow the relevant contract for the workflow you are building.

### Is there a free DeepSeek Search API tier?

The cited announcement describes temporary free server-side tool usage in specific coding-agent integrations. It does not establish a general free tier for every standalone Search or Fetch request. Check the current billing page before running a batch.

### Do I need Fetch after every search?

No. A search may provide enough information, especially when usable content is returned with `need_content: true`. Fetch is useful when you need to retrieve the selected page separately.

## Start with one retrieval path

The DeepSeek Search API finds sources, and Fetch retrieves a selected page. Start with one query, inspect the result and content, then decide whether your application needs additional pages or a model-generated summary. For the separate model update announced the same day, see [the October 17 checkpoint update: benchmarks and changes](https://seedrouter.ai/blog/deepseek-v4-1-flash-1017-benchmarks).
