请求地址
POST https://api.stepfun.com/step_plan/v1/search-image
请求参数
querystringrequired
搜索词,建议使用中文,也支持英文。topkintoptional
返回图片张数的上限。
请求响应
-
codeint
状态码,0表示成功。 -
msgstring
提示信息,成功时为空字符串。 -
dataobject
返回数据。
示例
- cURL
- Python
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
🎉 全新 Step Plan 上线 · Credit 月池随心用、加油包随时补,速来体验!立即查看 →
POST https://api.stepfun.com/step_plan/v1/search-image
query string requiredtopk int optionalcode int0 表示成功。
msg stringdata object显示 子属性
result object显示 子属性
block booltrue 表示命中拦截,此时 search_results 为空;false 表示未拦截。
search_results object array显示 子属性
contentUrl stringsnippet stringwidth intheight inthostPageUrl stringhostname stringcurl --location 'https://api.stepfun.com/step_plan/v1/search-image' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $STEPFUN_API_KEY' \
-d '{
"query": "故宫",
"topk": 2
}'
import os
import requests
resp = requests.post(
"https://api.stepfun.com/step_plan/v1/search-image",
headers={
"Authorization": f"Bearer {os.environ['STEPFUN_API_KEY']}",
"Content-Type": "application/json",
},
json={"query": "故宫", "topk": 2},
)
result = resp.json()["data"]["result"]
for item in result["search_results"]:
print(item["contentUrl"], item["snippet"])
{
"code": 0,
"msg": "",
"data": {
"result": {
"block": false,
"search_results": [
{
"contentUrl": "http://q1.itc.cn/images01/20250921/4aefdeaeff0f4f2999ce3e959a902265.jpeg",
"snippet": "故宫博物院,中国最大的古代文化艺术博物馆",
"width": 5650,
"height": 3687,
"hostPageUrl": "http://travel.sohu.com/a/937199080_122365627",
"hostname": "travel.sohu.com"
},
{
"contentUrl": "http://q2.itc.cn/images01/20251010/bf333868e5e243a6808ad887067a7766.jpeg",
"snippet": "北京故宫博物院今天过100岁生日",
"width": 1920,
"height": 1080,
"hostPageUrl": "http://gov.sohu.com/a/942413642_120479584",
"hostname": "gov.sohu.com"
}
]
}
}
}
此页面对您有帮助吗?