Image Search Engine
收藏Image Search Engine API 数据集概述
API 基本信息
- API名称: Image Search Engine
- 开发者: eightpotions
- 类别: Search
- 当前版本: v1
- API评分: 8.9 Popularity
- 服务等级: 74% Service Level
- 延迟: 567ms Latency
订阅计划
- BASIC: $0.00 / mo
- PRO: $0.00 / ---
API 功能概述
- 支持通过文本查询或图像上传搜索图像。
- 基于AI算法,提供高质量、相关性强的搜索结果。
- 索引超过十亿张图像。
- 支持安全搜索过滤(NSFW内容过滤)。
输入参数
| 参数 | 类型 | 是否必需 | 默认值 | 描述 |
|---|---|---|---|---|
input |
string | 是 | — | 搜索输入,可以是文本描述、图像URL或base64编码的图像字符串。 |
type |
string | 是 | — | 输入类型,接受 text(文本查询)或 image(图像URL或base64图像)。 |
safe |
bool | 否 | true |
是否过滤NSFW内容,设置为 false 可禁用安全搜索。 |
响应格式
json { "images": [ { "url": "https://example.com/image.jpg", "source": "https://example.com/page" } ] }
响应字段
| 字段 | 类型 | 描述 |
|---|---|---|
images |
array | 匹配的图像列表。 |
images[].url |
string | 图像文件的直接URL。 |
images[].source |
string | 图像出现的源网页。 |
示例代码
1. 通过文本搜索
python import requests
url = "https://image-search-engine.p.rapidapi.com/search"
querystring = { "input": "A black cat", "type": "text" }
headers = { "x-rapidapi-key": "YOUR_RAPIDAPI_KEY", "x-rapidapi-host": "image-search-engine.p.rapidapi.com" }
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
2. 通过图像URL搜索
python import requests
url = "https://image-search-engine.p.rapidapi.com/search"
querystring = { "input": "https://example.com/myimage.jpg", "type": "image" }
headers = { "x-rapidapi-key": "YOUR_RAPIDAPI_KEY", "x-rapidapi-host": "image-search-engine.p.rapidapi.com" }
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
3. 通过Base64图像搜索
python import base64 import requests
with open("myimage.jpg", "rb") as img_file: base64_image = base64.b64encode(img_file.read()).decode("utf-8")
url = "https://image-search-engine.p.rapidapi.com/search"
querystring = { "input": base64_image, "type": "image", "safe": "false" }
headers = { "x-rapidapi-key": "YOUR_RAPIDAPI_KEY", "x-rapidapi-host": "image-search-engine.p.rapidapi.com" }
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
错误处理
| 状态码 | 含义 |
|---|---|
200 OK |
请求成功。 |
400 Bad Request |
参数无效或缺失。 |
401 Unauthorized |
API密钥缺失或无效。 |
429 Too Many Requests |
超出速率限制。 |
500 Internal Server Error |
服务器错误,请稍后重试。 |
注意事项
safe参数默认为true,如需未过滤结果,需显式设置为false。- 对于base64输入,确保字符串正确编码且无换行符。
- 返回的图像URL可能会过期,如需存储请及时下载。



