RelayAB

接入文档

这一章回答:图片、视频、语音、音乐怎么生成。

图片、视频与语音

媒体生成走 OpenAI 形状的接口,同样用你的 API Key 调用。

先在「模型」里取模型 ID(含媒体模型),再按下面任一端点调用。媒体模型只出现在 OpenAI 的模型列表里。

文生图 — POST /v1/images/generations(JSON)
curl https://platform.aasim.l.cd/v1/images/generations \
  -H "Authorization: Bearer $RELAYAB_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "image-01", "prompt": "a red apple", "n": 1, "size": "1024x1024"}'
图生图 — POST /v1/images/edits(multipart,image 可重复,1–16 张参考图)
curl https://platform.aasim.l.cd/v1/images/edits \
  -H "Authorization: Bearer $RELAYAB_KEY" \
  -F model=image-01 \
  -F prompt="same character, new scene" \
  -F image=@reference.png \
  -F image=@second.png   # 1–16 references: repeat the field
异步任务 — POST /v1/media/jobs(立刻 202,再轮询 GET /v1/media/jobs/[id])
# Submit, get 202 immediately, then poll — nothing holds the connection.
curl https://platform.aasim.l.cd/v1/media/jobs \
  -H "Authorization: Bearer $RELAYAB_KEY" \
  -H "Content-Type: application/json" \
  -d '{"capability":"image.generate","model":"image-01","prompt":"a 4K poster","size":"2048x2048"}'

curl https://platform.aasim.l.cd/v1/media/jobs/JOB_ID \
  -H "Authorization: Bearer $RELAYAB_KEY"
视频生成 — POST /v1/videos/generations(JSON)
curl https://platform.aasim.l.cd/v1/videos/generations \
  -H "Authorization: Bearer $RELAYAB_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "video-01", "prompt": "a wave"}'
语音合成 — POST /v1/audio/speech(返回音频字节)
curl https://platform.aasim.l.cd/v1/audio/speech \
  -H "Authorization: Bearer $RELAYAB_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "tts-1", "input": "Hello!", "voice": "alloy"}' \
  --output speech.mp3
语音转写 — POST /v1/audio/transcriptions(multipart,上传 file)
curl https://platform.aasim.l.cd/v1/audio/transcriptions \
  -H "Authorization: Bearer $RELAYAB_KEY" \
  -F model=stt-1 \
  -F file=@speech.mp3
语音翻译 — POST /v1/audio/translations(multipart,上传 file)
curl https://platform.aasim.l.cd/v1/audio/translations \
  -H "Authorization: Bearer $RELAYAB_KEY" \
  -F model=whisper-1 \
  -F file=@speech.mp3
音乐生成 — POST /v1/audio/music(JSON)
curl https://platform.aasim.l.cd/v1/audio/music \
  -H "Authorization: Bearer $RELAYAB_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "music-01", "prompt": "lo-fi beat"}'
音色列表 — GET /v1/audio/voices(本服务新增,OpenAI 没有这个接口)
curl https://platform.aasim.l.cd/v1/audio/voices \
  -H "Authorization: Bearer $RELAYAB_KEY"

音色列表是本服务自己加的接口:OpenAI 根本没有它,音色写在 voice 参数的类型里,这里只借用了它的列表信封。data 里的 models 为 null 表示「没有被收窄」(该模型下每个音色都能用),而不是「不知道」;narrowedBy 说明是谁收窄的。某个供应商读不到时会出现在 unavailable 里,不会被当成空列表。读取不计费,并按供应商缓存 5 分钟。

在「模型」页的测试界面里可以直接选音色:用的就是这份列表,按你选的模型过滤;也可以选「手动填写」自己填一个音色 id。

计费按「每件」:成功产出的图片/音频各扣一次,被内容安全拦截或失败的不计费。

还有疑问?联系你的管理员。

    接入文档 - RelayAB