按画面、风格、场景、角色或用途检索视觉参考。
Xixi API
西西 API
用一句画面描述搜索西西提示词图库,返回匹配的图片、视频和提示词,方便接入 Agent、Skill、插件或应用。
Search endpoint
POST https://ccprompt.com/api/v1/search
返回图片、视频、提示词、详情页、比例和相似度。
第一版先提供整体搜索,按需要可限制返回图片或视频。
API Keys
申请 Key
登录后可以创建西西 API Key。每个账号最多保留 10 个有效 Key。
登录 / 注册Docs
调用文档
Base URL
https://ccprompt.com/api/v1
认证方式
所有请求都需要在 Header 里携带 API Key。
POST /search
Authorization: Bearer xixi_live_your_key
Content-Type: application/json
搜索接口
| 项目 | 说明 |
|---|---|
| Method | POST |
| Path | /search |
| Content-Type | application/json |
| 用途 | 根据自然语言描述搜索图库,返回匹配的图片、视频和提示词。 |
请求示例
{
"query": "未来城市里的机器人咖啡馆,适合做短视频封面",
"mediaType": "image",
"limit": 12
}
返回示例
{
"ok": true,
"product": "xixi-api",
"query": "未来城市里的机器人咖啡馆,适合做短视频封面",
"results": [
{
"id": "item_xxx",
"mediaType": "image",
"title": "Robot cafe in a futuristic city",
"imageUrl": "https://media.ccprompt.com/...",
"thumbnailUrl": "https://media.ccprompt.com/...",
"videoUrl": "",
"prompt": "...",
"detailUrl": "https://ccprompt.com/item/item_xxx",
"score": 0.82
}
]
}
请求字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| query | string | 是 | 自然语言画面描述。可以写主题、风格、场景、角色、用途,例如“适合电商海报的清爽产品图”。 |
| mediaType | string | 否 | 返回类型。留空表示图片和视频都搜索;填 image 只返回图片;填 video 只返回视频。 |
| limit | number | 否 | 返回数量。默认 20,最小 1,最大 50。 |
| page | number | 否 | 分页页码。默认 1,适合继续查看更多结果。 |
返回字段
| 字段 | 类型 | 说明 |
|---|---|---|
| ok | boolean | 请求是否成功。 |
| product | string | 固定为 xixi-api。 |
| query | string | 本次搜索使用的自然语言描述。 |
| mediaType | string | 本次搜索的类型范围,可能是 all、image 或 video。 |
| page | number | 当前页码。 |
| limit | number | 本次请求的返回数量上限。 |
| total | number | 匹配结果总数。 |
| totalPages | number | 总页数。 |
| results | array | 搜索结果列表。 |
results 字段
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 结果 ID,可用于去重或记录用户选择。 |
| mediaType | string | 媒体类型,image 或 video。 |
| title | string | 标题。可能为空,建议以 prompt 作为主要文本。 |
| imageUrl | string | 适合展示的大图地址。视频结果通常也会提供封面图。 |
| thumbnailUrl | string | 缩略图地址,适合列表、卡片和快速预览。 |
| videoUrl | string | 视频地址。图片结果为空。 |
| prompt | string | 提示词正文,可用于参考、改写或继续生成。 |
| author | string | 作者或来源署名,可能为空。 |
| ratio | string | 画面比例,例如 1:1、16:9、9:16。 |
| width | number | 媒体宽度,未知时为 0。 |
| height | number | 媒体高度,未知时为 0。 |
| tags | array | 基础标签,例如图片、视频、比例等。 |
| score | number | 语义匹配分数,越高通常越接近 query。 |
| detailUrl | string | 西西提示词详情页链接,适合让用户查看完整内容。 |
错误格式
{
"ok": false,
"error": {
"code": "missing_api_key",
"message": "Missing Authorization Bearer token."
}
}
常见错误码
| HTTP | code | 说明 |
|---|---|---|
| 401 | missing_api_key | 请求没有携带 Authorization Bearer token。 |
| 401 | invalid_api_key | Key 不存在、已作废或不可用。 |
| 400 | missing_query | 缺少 query 字段。 |
| 429 | rate_limited | 请求过快,请稍后重试。 |
| 503 | search_unavailable | 搜索服务暂时不可用。 |
curl 示例
curl https://ccprompt.com/api/v1/search \
-H "Authorization: Bearer xixi_live_your_key" \
-H "Content-Type: application/json" \
-d "{\"query\":\"适合电商海报的清爽产品图\",\"mediaType\":\"image\",\"limit\":8}"
西西 API 提供视觉灵感搜索和提示词参考,适合用于选题、构图、风格探索和提示词改写。