关于 images-search
通过 Brave Search API 搜索图片的技能,可返回图片元数据、缩略图和来源链接,并支持设置地区、结果数量、拼写检查及 SafeSearch。
主要功能
- 01通过 Brave API 搜索图片
- 02按国家和语言筛选
- 03结果数量最高设为 200
- 04选择严格或关闭 SafeSearch
- 05获取缩略图和图片元数据
适用场景
- 01为图库和情绪板寻找图片
- 02为文章补充相关图片
- 03为视觉分析获取图片结果
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ brave/ brave-search-skills --skill images-search安装后在 Claude Code 中输入/images-search确认已加载。
详细介绍
图片搜索
需要 API 密钥:在 https://api.search.brave.com 获取
套餐:包含在 Search 套餐中。请参阅 https://api-dashboard.search.brave.com/app/subscriptions/subscribe
快速入门(cURL)
基本搜索
curl -s "https://api.search.brave.com/res/v1/images/search?q=mountain+landscape" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"
使用参数
curl -s "https://api.search.brave.com/res/v1/images/search" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-G \
--data-urlencode "q=northern lights photography" \
--data-urlencode "country=US" \
--data-urlencode "search_lang=en" \
--data-urlencode "count=20" \
--data-urlencode "safesearch=strict"
端点
GET https://api.search.brave.com/res/v1/images/search
身份验证:X-Subscription-Token: <API_KEY> 请求头
参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
q | string | 是 | - | 搜索查询(1-400 个字符,最多 50 个词) |
country | string | 否 | US | 搜索国家/地区(2 个字母的国家/地区代码或 ALL) |
search_lang | string | 否 | en | 至少 2 个字符的语言代码 |
count | int | 否 | 50 | 返回的结果数量(1-200) |
safesearch | string | 否 | strict | off 或 strict(图片搜索不支持 moderate) |
spellcheck | bool | 否 | true | 自动更正查询;更正后的查询位于 query.altered |
响应格式
{
"type": "images",
"query": {
"original": "mountain landscape",
"altered": null,
"spellcheck_off": false,
"show_strict_warning": false
},
"results": [
{
"type": "image_result",
"title": "Beautiful Mountain Landscape",
"url": "https://example.com/mountain-photo",
"source": "example.com",
"page_fetched": "2025-09-15T10:30:00Z",
"thumbnail": {
"src": "https://imgs.search.brave.com/...",
"width": 200,
"height": 150
},
"properties": {
"url": "https://example.com/images/mountain.jpg",
"placeholder": "https://imgs.search.brave.com/placeholder/...",
"width": 1920,
"height": 1080
},
"meta_url": {
"scheme": "https",
"netloc": "example.com",
"hostname": "example.com",
"favicon": "https://imgs.search.brave.com/favicon/...",
"path": "/mountain-photo"
},
"confidence": "high"
}
],
"extra": {
"might_be_offensive": false
}
}
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 始终为 "images" |
query.original | string | 原始查询 |
query.altered | string? | 拼写检查后的查询(如果未更正则为 null) |
query.spellcheck_off | bool? | 是否已禁用拼写检查 |
query.show_strict_warning | bool? | strict 安全搜索隐藏了相关结果时为 True |
results[] | array | 图片结果列表 |
results[].type | string | 始终为 "image_result" |
results[].title | string? | 图片标题 |
results[].url | string? | 找到图片的页面 URL |
results[].source | string? | 来源域名 |
results[].page_fetched | string? | 上次抓取页面的 ISO 日期时间 |
results[].thumbnail.src | string? | Brave 代理的缩略图 URL(宽约 500px) |
results[].thumbnail.width | int? | 缩略图宽度 |
results[].thumbnail.height | int? | 缩略图高度 |
results[].properties.url | string? | 原始全尺寸图片 URL |
results[].properties.placeholder | string? | 低分辨率占位图 URL(由 Brave 代理) |
results[].properties.width | int? | 原始图片宽度(可能为 null) |
results[].properties.height | int? | 原始图片高度(可能为 null) |
results[].meta_url.scheme | string? | URL 协议方案 |
results[].meta_url.netloc | string? | 网络位置 |
results[].meta_url.hostname | string? | 转为小写的域名 |
results[].meta_url.favicon | string? | 网站图标 URL |
results[].meta_url.path | string? | URL 路径 |
results[].confidence | string? | 相关性:low、medium 或 high |
extra.might_be_offensive | bool | 结果是否可能包含冒犯性内容 |
使用场景
- 发现视觉内容:构建图片库、情绪板或视觉研究工具。使用
count=200获取全面的结果。需要图片专属元数据(尺寸、缩略图)时,优先于web-search使用。 - 丰富内容:为文章或生成的内容添加相关图片。使用
country和search_lang来定位受众所在地区。 - 安全地检索图片:默认的
safesearch=strict可确保结果适合全家浏览。仅有两种模式(off/strict),没有 moderate 选项,这与网页、视频和新闻搜索不同。 - 大批量检索:每次请求最多可返回 200 张图片(网页搜索为 20 条,视频/新闻搜索为 50 条)。非常适合批量收集图片或视觉分析流水线。
注意事项
- SafeSearch:图片搜索默认为
strict(比网页搜索更严格) - 大批量:每次请求最多可返回 200 条结果
- 缩略图:由 Brave 代理,以保护用户隐私(宽 500px)。原始全分辨率图片请使用
properties.url。 - 尺寸:部分图片可能没有
properties.width/height - 占位图:
properties.placeholder是低分辨率 URL(不是内嵌 base64),可用于渐进式加载体验
评论
支持 Markdown