Skip to main content
三个 GET 端点全部无认证,是对 kira-cms(op.kira.art/api/cached/* 的只读代理。源:src/hono/op/index.ts

通用约定

  • i18n:读 Accept-Language 头(默认 en-US),按 localeFieldMap 映射到 CMS 的 _xx 后缀字段,取不到回退 _en。支持 12 语言(en/zh_CN/zh_TW/ja/ko/de/es/fr/it/ms/pt/ru)
  • fail-open:CMS 上游失败(非 200 / fetch 抛错)时返回空响应,只 appLog.warn(不 error —— dependency-error-rate alert 已在 CLIENT span 上盯 kira-cms 5xx,重复 error 会让 ERROR rate 误报服务故障)
  • CMS base URL 来自 CMS_URL(默认 https://op.kira.art

GET /op/announcement

读全站公告。上游 GET {CMS_URL}/api/cached/announcements

响应

{
  announcement: string,    // = title,向后兼容字段
  url: string,
  visible: boolean,
  title: string,
  description: string,
  imageUrl: string
}
visible = false 或上游失败时全部字段为空(announcement/url/title/description/imageUrl = ""visible: false)。

GET /op/homecards/v2

读首页卡片 V2。上游 GET {CMS_URL}/api/cached/home-cards-v2

响应

{
  cards: Array<{
    id: string,                  // = cardId
    coverType: "image" | "video",
    image: string,
    coverVideo: string,
    arcadeLink: string,
    mobileArcadeLink: string,
    requiredPlan: "free" | "basic" | "basic_year" | "pro" | "pro_year" | "max" | "max_year",
    title: string,
    description: string,
    prompt: string,
    isFeatured: boolean,
    model: "lite" | "nova" | "ultra",
    ratio: "auto" | "1:1" | "4:3" | "3:4" | "16:9" | "9:16",
    mediaType: "image" | "video",
    inputMedias: Array<{ type: "image" | "video", url: string }>
  }>,
  featuredCardIds: string[]
}
音频已下线:存量 CMS 卡片若仍为 audio,运行时整卡过滤掉;inputMedias 里的 audio 项也过滤掉。失败回退 { cards: [], featuredCardIds: [] }

GET /op/trending

读 Trending 列表。上游 GET {CMS_URL}/api/cached/trending

响应

{
  items: Array<{
    title: string,
    coverType: "image" | "video",
    cover: string,    // coverType=video → coverVideo.url,否则 coverImage.url
    url: string
  }>
}
失败回退 { items: [] }

src/hono/op/index.ts

相关