跳至主要內容
API 參考
API 參考

DeepSeek Search

透過 RunAPI 的 DeepSeek 相容 Search 操作傳送請求。

01

概覽

此路徑選擇同步搜尋。無需提供模型,不支援串流回應。未知欄位會被接受但忽略。

快速入門

  1. 建立 API 金鑰並將其設定為 RUNAPI_API_KEY。
  2. 傳送文件所列的 JSON 請求主體,無需提供模型。
  3. 讀取 JSON 回應並處理文件所列的協定錯誤。

端點

POST /v1/tools/search
基礎 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

協定錯誤:invalid_request

HTTP 400

結構描述

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

結構描述

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

結構描述

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 範例均透過此合約發送已驗證的請求,無需使用特定協議的 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())