API 參考
DeepSeek Search
透過 RunAPI 的 DeepSeek 相容 Search 操作傳送請求。
01
概覽
此路徑選擇同步搜尋。無需提供模型,不支援串流回應。未知欄位會被接受但忽略。
快速入門
- 建立 API 金鑰並將其設定為 RUNAPI_API_KEY。
- 傳送文件所列的 JSON 請求主體,無需提供模型。
- 讀取 JSON 回應並處理文件所列的協定錯誤。
端點
- 基礎 URL
https://runapi.ai- 合約版本
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
JSON 請求內文請求合約
此路徑選擇同步搜尋。無需提供模型,不支援串流回應。未知欄位會被接受但忽略。
JSON 主體5 個欄位
countinteger
選填
請求的結果數量,範圍為 1 到 50。
localizationstring
選填
本地化提示,例如終端使用者的 IP 位址。
need_contentboolean
選填
請求在搜尋結果中包含頁面內容。
ori_question["string", "null"]
選填
原始問題,長度為 1–128 個 Unicode 字元。Null 視為未提供。
querystring
必填
搜尋查詢,長度為 1–128 個 Unicode 字元,不能全部為空白字元。
請求範例
JSON
{
"count": 5,
"localization": "203.0.113.7",
"need_content": true,
"ori_question": null,
"query": "DeepSeek V4 release"
}
05
HTTP 200
同步回應
結構描述
JSON
{
"additionalProperties": true,
"properties": {
"results": {
"description": "搜尋結果。空陣列也是成功回應,且不收費。",
"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
HTTP 400
協定錯誤:invalid_request
結構描述
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
HTTP 429
協定錯誤:rate_limited
結構描述
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"
}
}
09
產生的程式碼範例
每個 cURL、JavaScript 和 Python 範例均會從此契約傳送經驗證的請求,無需特定協定的 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())