Documentation Index
Fetch the complete documentation index at: https://tech.illasoft.com/llms.txt
Use this file to discover all available pages before exploring further.
基础信息
- Base URL:
https://api.kira.art
- 开发环境:
http://localhost:8080
- 认证方式:Bearer JWT(Supabase Auth)
- 响应格式:JSON
- OpenAPI spec:
openapi.yaml
Billing 路由已迁移:订阅/Booster/Portal/Webhook 全部走 billing.kira.art(详见 Kira SG Billing)。kira-be 只保留使用时的 credit 扣减和用户删除时的 Stripe customer 清理。
Authorization: Bearer <supabase-jwt>
- 受保护路由用
supabaseAuth() 中间件验证 ES256 JWT
- 公开但可带 token 的路由用
optionalSupabaseAuth()(验证失败也继续)
- Sentry 用户上下文自动注入
jwtPayload.sub / email
路由前缀
| 前缀 | 用途 | 认证 |
|---|
/agent | AI 对话、SSE 流、task 保存、stream 重连 | JWT |
/thread | 线程 CRUD、timeline 聚合 | JWT |
/user | Profile 查询/更新、头像 CSAM、账户删除 | JWT / 密码保护 |
/feed | 社交 feed 列表、查询、featured、删除 | 可选 JWT |
/publish | Image / Video / Audio 三路发布 | JWT |
/like | Feed 点赞 | JWT + 可选 |
/filter | 预设滤镜 + 用户收藏 | JWT |
/image | get / delete / CSAM check | 可选 |
/images | 批量查询 | 无 |
/video | task / info / submit / initialize / upload | JWT |
/music | task / info / submit / initialize / upload | JWT |
/rewind | check / versions / messages | 无 |
/version | /versions/:threadId 版本聚合 | JWT |
/download | 带水印图片/视频下载 | JWT |
/mail | daily / account-deletion 邮件发送 | 密码保护 |
/support | Front Chat hash / 账户删除调度 | JWT |
/sitemap | users / feeds 爬虫 | 无 |
/op | CMS 代理:announcement / homecards/v2 / trending | 无(i18n by Accept-Language) |
/health | 健康检查 | 无 |
完整路由清单
Agent(AI 对话)
| Method | Path | 说明 |
|---|
| GET | /agent/chatMessages/:threadId | 消息历史(v4→v5 自动迁移) |
| GET | /agent/rewind/:threadId/:messageId | rewind 点之前的消息 |
| POST | /agent/streaming | SSE 流式 AI 对话(核心) |
| POST | /agent/task | 保存 AI 生成的版本 + 派发 video/music Inngest events |
| GET | /agent/task/:threadId/status | 查询 agent 运行状态 |
| POST | /agent/task/:threadId/stop | 中止当前 agent(AbortController + Redis cancel flag) |
| GET | /agent/stream/:threadId | SSE 重连,从 Redis stream 重放 chunks |
Thread
| Method | Path | 说明 |
|---|
| POST | /thread/ | 创建线程;Mistral 生成标题;首消息触发非阻塞 CSAM |
| GET | /thread/threads | 用户线程列表 |
| DELETE | /thread/:threadId | 删除线程;异步取消 video/music 任务 + 清理存储 |
| GET | /thread/timelines | 分页 5 条/页;服务端 mixed-media 聚合 |
User
| Method | Path | 说明 |
|---|
| GET | /user/profile | 当前用户完整 profile(含 credits) |
| PUT | /user/profile | 更新;头像 CSAM(451 错误) |
| GET | /user/profile/:userId | 公开 profile |
| GET | /user/:userId/feed | 用户发布的 feed 分页 |
| GET | /user/:userId/liked | 用户点赞的 feed 分页 |
| GET | /user/referral-info | 推荐信息 |
| GET | /user/authBg | 登录页背景图 |
| DELETE | /user/ | 密码保护;删除 Stripe customer + PostHog + Supabase 账号 |
Feed / Publish / Like
| Method | Path | 说明 |
|---|
| GET | /feed/ | 分页 20/页;nsfw 过滤 |
| GET | /feed/featured | 精选(无分页) |
| GET | /feed/:id | 单条查询 |
| DELETE | /feed/:id | 删除 + LanceDB embedding 清理 |
| POST | /publish/ | Image 发布(默认 media_type=null) |
| POST | /publish/video | Video 发布;缩略图审核 |
| POST | /publish/audio | Audio 发布;cover+lyrics+prompt 三路 CSAM |
| GET | /like/:feedId | 查询是否点赞 |
| PUT | /like/:feedId | 点赞(upsert) |
| DELETE | /like/:feedId | 取消点赞 |
Image / Images
| Method | Path | 说明 |
|---|
| GET | /image/:imageId | 查询图片 + 签名 URL |
| DELETE | /image/:imageId | 删除(含所有派生) |
| POST | /image/check/:imageId | CSAM 检查;命中返回 451 + 删除 |
| GET | /images/:imageIds | 批量查询(逗号分隔) |
Video / Music
| Method | Path | 说明 |
|---|
| GET | /video/task/:taskId | 视频任务状态 + Signed URL |
| GET | /video/info/:videoIds | 批量查询(逗号分隔) |
| POST | /video/submit/:taskId | 余额/plan 恢复后重发 Inngest |
| POST | /video/initialize | 占位符任务(video edit/extend 的 source) |
| DELETE | /video/upload/:taskId | 删除媒体文件 |
| GET | /music/task/:taskId | 音乐任务状态 |
| GET | /music/info/:audioIds | 批量查询 |
| POST | /music/submit/:taskId | 恢复后重发 |
| POST | /music/initialize | 占位符任务 |
| DELETE | /music/upload/:taskId | 删除 |
Rewind / Version / Download
| Method | Path | 说明 |
|---|
| GET | /rewind/check/:originImageId | 是否有历史版本(nsfw 线程阻断) |
| GET | /rewind/versions/:feedId | Feed 对应的版本历史 |
| GET | /rewind/messages/:feedId | 原始消息 |
| GET | /version/versions/:threadId | 线程所有版本(JWT) |
| POST | /download/ | 带水印图片下载(生成或缓存) |
| POST | /download/video | 带水印视频下载 |
Filter
| Method | Path | 说明 |
|---|
| GET | /filter/preset | 预设滤镜列表 |
| POST | /filter/like | 收藏滤镜(upsert) |
| DELETE | /filter/like/:filterId | 取消收藏 |
| GET | /filter/liked | 用户收藏列表 |
Support / Mail
| Method | Path | 说明 |
|---|
| GET | /support/hash | Front Chat HMAC-SHA256(userId) |
| POST | /support/delete-account | 30 天账户删除调度 + 立即邮件 |
| GET | /support/deletion-status | 查询调度状态 |
| POST | /support/cancel-delete-account | 取消调度 + 确认邮件 |
| POST | /mail/daily | 密码保护;free 用户每日邮件 |
| POST | /mail/account-deletion | 密码保护;账户删除各阶段邮件 |
CMS Proxy / Sitemap / Health
| Method | Path | 说明 |
|---|
| GET | /op/announcement | 从 CMS 读公告,按 Accept-Language 选语言 |
| GET | /op/homecards/v2 | Home Cards V2(Featured/Image/Video/Audio) |
| GET | /op/trending | Trending 区 |
| GET | /sitemap/users | 用户 ID(≤10000) |
| GET | /sitemap/feeds | Feed ID(排除 nsfw) |
| GET | /health | { status: "ok" } |
通用响应
部分端点返回具体对象(feed、thread、image、video、audio、profile 等),参见各 API 页面。
{ "message": "Error description" }
| 状态码 | 含义 |
|---|
| 200 | 成功 |
| 400 | 参数错误 |
| 401 | 未授权(JWT 无效/过期) |
| 403 | 禁止访问(plan 不够、未拥有资源) |
| 404 | 资源不存在 |
| 451 | CSAM 命中(图片/头像) |
| 500 | 服务器错误 |
CORS
https://*.kira.art、https://kira.art、https://op.kira.art
- 开发环境允许所有来源
异步任务和实时推送
所有视频/音乐生成通过 Inngest 派发(kira-be/src/lib/tasks.ts),Worker 回调通过 Centrifugo 推送:
- Channel:
{userId}/{threadId}#{userId}
- Event type:
video_status / audio_status
详见 Kira Inngest。
当前无全局 rate limit,业务层面的约束:
- 用户 plan → credit 余额
- Inngest per-user-per-tool concurrency = 1(同工具串行)
- CSAM 阻断:命中后不扣费但后续请求仍会被审核
Billing 和 Credits
| 职责 | 位置 |
|---|
| 订阅 / Booster / Portal / Webhook | kira-sg-billing |
使用时 credit 扣减(RPC deduct_credits) | kira-be src/ai/libs/billing.ts |
| 删除用户清理 Stripe customer | kira-be src/hono/user/index.ts:33-88 |