跳转到内容

模型 API

模型 API 返回带价格的模型目录,无需 API 密钥。完整的结构见 OpenAPI 定义和 API 参考。

GET /v1/models

查询参数均为可选,多个筛选条件按 AND 组合:

  • modality:只返回主模态(modality 字段)匹配的模型。同时输出音频的视频模型只在 video 下返回,不会在 audio 下返回;全部输出模态列在 capabilities.output_modalities 中。取值为 text, image, video, audio 之一。
  • task:只返回支持该任务的模型。取值为 chat, text-to-image, image-edit, text-to-video, image-to-video, reference-to-video, text-to-speech 之一。
  • locale:summary、description 和参数说明所用的语言。取值为 en、ja、zh、ko 之一,默认为 en。

传入这些列表之外的值会返回 400 和 invalid_request,error.details.allowed 会列出可接受的值。

终端窗口
curl "https://api.sakuranbo.ai/v1/models?modality=image&locale=en"

响应包含 object: "list" 和模型的 data 数组。每个模型包含:

  • id、name、vendor、vendor_name、modality、tasks、status 和 endpoint(运行该模型的生成端点)。
  • released_at(仅在发布日期已确认时提供)和 updated_at。
  • summary、description、capabilities 和 parameters(JSON Schema 风格的输入字段)。
  • pricing:每个价格项一条,包含 amount_micro_usd(整数)、amount_usd(十进制字符串)和 conditions(决定该价格的输入值)。
  • data_policy,以及指向模型页面及其 Markdown 版本的 links。

GET /v1/models/{vendor}/{model}

终端窗口
curl "https://api.sakuranbo.ai/v1/models/sakuranbo/cherryimage-1.0-pro"

目录中不存在的 ID 会返回 404 和 model_not_found。

公开的 GET 响应允许任意来源,带有弱 ETag,并使用 Cache-Control: public, max-age=60。目录没有变化时,发送 If-None-Match 会得到 304。

模型 ID模态任务上游状态
sakuranbo/cherrytext-1.0-flashtextchatGA(上游)
sakuranbo/cherry-1.0-provideotext-to-video, image-to-video, reference-to-videoGA(上游)
sakuranbo/cherryimage-1.0-proimagetext-to-image, image-editGA(上游)