> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiyi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Справочник по DeepSeek Web Search API

> Справочник и песочница DeepSeek Search API: параметры /v1/tools/search, поисковые операторы, структура ответа и коды ошибок.

> [!NOTE]
>
> Попробуйте в Playground справа: укажите `Bearer sk-your-api-key` (ключ в группе `default` или `svip`) в **Authorization**.
> Пример по умолчанию уже заполнен; нажмите «Отправить», чтобы увидеть результат. Каждый успешный вызов тарифицируется один раз.
> `localization` принимает **IP-адрес пользователя** (например, `8.8.8.8`); код локали, такой как `en-US`, возвращает ошибку 400.

> [!TIP]
>
> Тарифы, тестовые данные и важная информация приведены в разделе [Обзор](/ru/api-capabilities/deepseek-search-fetch/overview).

## Справочник параметров

| Параметр | Тип | Обязательный | Описание |
| - | - | - | - |
| `query` | string | ✓ | От 1 до 128 символов, не только пробелы. Поддерживает `site:`, `-site:`, `"..."`, `lang:`, `after:`, `before:` и другие операторы |
| `count` | int | | 1–50, по умолчанию 10. Не влияет на стоимость |
| `need_content` | bool | | По умолчанию `false`; если `true`, каждый результат включает в себя тело страницы |
| `ori_question` | string | | Исходный вопрос пользователя, от 1 до 128 символов |
| `localization` | string | | **IP-адрес пользователя** (не код локали), используется для локализованного ранжирования |

Тело запроса не требует наличия поля `model`; неизвестные поля игнорируются.

## Ключевые особенности ответа

```json theme={null}
{
  "results": [
    {
      "title": "...",
      "url": "https://...",
      "snippet": "short summary, about 100–200 characters",
      "summary": "long summary, about 600–800 characters",
      "content": "",
      "rerank_score": 2.1,
      "authority": 3,
      "date": "2026-10-20T08:00:00Z",
      "site_name": "...",
      "site_icon": "https://..."
    }
  ]
}
```

* Передавайте `summary` моделям, а `snippet` показывайте людям. Для получения полного текста либо включите `need_content`, либо выберите несколько результатов и используйте [Fetch](/ru/api-capabilities/deepseek-search-fetch/fetch-api)
* `rerank_score` ≥ 1.5 и `authority` ≥ 3 указывают на высококачественные результаты и отлично подходят в качестве пороговых значений для фильтрации
* С `count=50` размер ответа составляет около 180 КБ, а `need_content` увеличивает его более чем в два раза; настройте таймаут клиента соответствующим образом

## Коды ошибок

| HTTP | Пример сообщения | Причина и решение | Тарифицируется |
| - | - | - | - |
| 400 | `'count' must be between 1 and 50` | `count` вне допустимого диапазона | Нет |
| 400 | `'query' must not be empty` / `missing field 'query'` | `query` отсутствует или пусто | Нет |
| 400 | `'localization' must be a valid IP address` | Передан код локали; передайте IP или удалите это поле | Нет |
| 401 | `Invalid token.` | Недействительный ключ API или отсутствует заголовок `Authorization` | Нет |
| 429 | — | Превышен лимит запросов вышестоящего сервиса (100 QPS); подождите и повторите попытку | Нет |
| 503 | `no available channels for model deepseek-search` | В группе ключа отсутствует этот API (например, ClaudeCode); используйте ключ `default` / `svip` | Нет |
| 5xx / 504 | — | Внутренняя ошибка или таймаут вышестоящего сервиса; повторите попытку позже | Нет |

Поле `type` в теле ошибки всегда имеет значение `shell_api_error`; выполняйте ветвление по коду статуса HTTP.


## OpenAPI

````yaml api-reference/deepseek-search-openapi-en.yaml POST /v1/tools/search
openapi: 3.1.0
info:
  title: DeepSeek Web Search API
  description: >
    `deepseek-search` — DeepSeek's native web search API. Returns structured
    search results for a query, built for agents and RAG.


    - Not a chat model and consumes no tokens: **billed per successful
    request**; `count` and `need_content` do not affect the price

    - Parameter errors such as 400 are not billed

    - Upstream rate limit: 100 QPS

    - Available in the `default` / `svip` groups; ClaudeCode group keys cannot
    call it


    **Authentication**: header `Authorization: Bearer YOUR_API_KEY`


    **Get an API key**: create one in the APIYI console at `api.apiyi.com/token`
  version: 1.0.0
servers:
  - url: https://api.apiyi.com
    description: Primary endpoint
security:
  - bearerAuth: []
paths:
  /v1/tools/search:
    post:
      tags:
        - Search & Fetch
      summary: 'Web search: deepseek-search'
      description: >
        Send a query, get 1–50 web search results. The request body does not
        need a `model` field.


        `query` supports search operators: `site:` (join several with `OR`),
        `-site:`, `"..."`, `-"..."`, `-keyword`, `lang:zh,en`, `after:`,
        `before:`.
      operationId: deepseekToolsSearch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
            example:
              query: DeepSeek V4 release
              count: 5
      responses:
        '200':
          description: Search succeeded (billed once)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
              example:
                results:
                  - title: DeepSeek V4 released
                    url: https://example.com/news/deepseek-v4
                    snippet: A short snippet of about 100–200 characters...
                    summary: A long summary of about 600–800 characters...
                    content: ''
                    rerank_score: 2.1
                    authority: 3
                    date: '2026-10-20T08:00:00Z'
                    site_name: Example News
                    site_icon: https://example.com/favicon.ico
        '400':
          description: >-
            Invalid parameters, not billed: `count` outside 1–50, empty or
            missing `query`, `localization` not an IP address, etc.
        '401':
          description: Invalid API key
        '429':
          description: Upstream rate limit exceeded (100 QPS); wait and retry
        '503':
          description: >-
            This API is not enabled for the key's group (e.g. ClaudeCode); use a
            default / svip group key
      security:
        - bearerAuth: []
components:
  schemas:
    SearchRequest:
      type: object
      required:
        - query
      properties:
        query:
          type: string
          description: >-
            Search query, 1–128 characters, not all whitespace. Supports site: /
            lang: / after: and other operators
          example: DeepSeek V4 release
        count:
          type: integer
          minimum: 1
          maximum: 50
          default: 10
          description: Number of results, 1–50. Does not affect the price
          example: 5
        need_content:
          type: boolean
          default: false
          description: >-
            Whether to return the page body. When false, content is always an
            empty string
        ori_question:
          type: string
          description: >-
            The user's original question that triggered this search, 1–128
            characters
        localization:
          type: string
          description: >-
            The user's IP address, used to prioritize localized results. **Not a
            locale code**: passing ja-JP returns 400
          example: 8.8.8.8
    SearchResponse:
      type: object
      properties:
        results:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
              url:
                type: string
              snippet:
                type: string
                description: Short snippet, about 100–200 characters, for display
              summary:
                type: string
                description: Long summary, about 600–800 characters, for models
              content:
                type: string
                description: Page body; empty string when need_content is false
              rerank_score:
                type: number
                description: Relevance score 0–3; 1.5 or higher is high quality
              authority:
                type: integer
                description: >-
                  Site authority 0–4, -1 = unknown; 3 or higher is highly
                  authoritative
              date:
                type:
                  - string
                  - 'null'
                description: Publication time, UTC RFC 3339
              site_name:
                type:
                  - string
                  - 'null'
              site_icon:
                type:
                  - string
                  - 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Add Authorization: Bearer YOUR_API_KEY to the request headers'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.