跳到正文
API 参考
API 参考

DeepSeek Search

通过 RunAPI 的 DeepSeek 兼容 Search operation 发送请求。

01

概览

Synchronous search selected by this path. No model is required and streaming is not supported. Unknown fields are accepted but ignored.

快速开始

  1. 创建 API Key,并将其设置为 RUNAPI_API_KEY。
  2. 发送文档所列的 JSON 请求体,无需提供模型。
  3. 读取 JSON 响应并处理文档所列的协议错误。

端点

POST /v1/tools/search
基础 URL
https://runapi.ai
Contract 版本
v1
首选身份验证
Authorization: Bearer YOUR_API_TOKEN
02

身份验证载体

RunAPI 接受下列每种载体;生成的示例使用该协议的首选请求头。

header - 首选
Authorization: Bearer YOUR_API_TOKEN
header
x-api-key: YOUR_API_TOKEN
header
x-goog-api-key: YOUR_API_TOKEN
query
?key=YOUR_API_TOKEN
03

兼容模型

打开模型页可查看当前价格、限流和商业使用详情。

展开 1 个兼容模型
04

请求 Contract

JSON 请求体

Synchronous search selected by this path. No model is required and streaming is not supported. Unknown fields are accepted but ignored.

JSON 请求体5 个字段
countinteger
可选

Number of results requested from 1 to 50.

localizationstring
可选

Localization hint such as the end user's IP address.

need_contentboolean
可选

Request page content in search results.

ori_question["string", "null"]
可选

Original question of 1–128 Unicode characters. Null is treated as omitted.

querystring
必填

Search query of 1–128 Unicode characters; must not consist entirely of whitespace.

请求示例

JSON
{
  "count": 5,
  "localization": "203.0.113.7",
  "need_content": true,
  "ori_question": null,
  "query": "DeepSeek V4 release"
}
05

同步响应

HTTP 200

Schema

JSON
{
  "additionalProperties": true,
  "properties": {
    "results": {
      "description": "Search results. An empty array is a successful response and incurs no charge.",
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "results"
  ],
  "type": "object"
}

示例

JSON
{
  "results": [
    {
      "snippet": "Browse DeepSeek models and API documentation.",
      "title": "DeepSeek models on RunAPI",
      "url": "https://runapi.ai/models/deepseek"
    }
  ]
}
06

协议错误:invalid_request

HTTP 400

Schema

JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

示例

JSON
{
  "error": {
    "message": "'query' is required",
    "type": "invalid_request_error"
  }
}
07

协议错误:rate_limited

HTTP 429

Schema

JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

示例

JSON
{
  "error": {
    "message": "Too many requests, please retry later",
    "type": "rate_limit_error"
  }
}
08

协议错误:unavailable

HTTP 503

Schema

JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

示例

JSON
{
  "error": {
    "message": "Service temporarily unavailable",
    "type": "service_unavailable"
  }
}
09

生成的代码示例

每个 cURL、JavaScript 和 Python 示例都会发送此 Contract 中经过验证的请求,无需协议专用 SDK。

安装

Shell
pip install requests
PYTHON
import requests

response = requests.post(
    "https://runapi.ai/v1/tools/search",
    headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
    json={"query": "DeepSeek V4 release", "count": 5, "ori_question": None, "localization": "203.0.113.7", "need_content": True}
)
response.raise_for_status()
print(response.json())