媒体生成
POST /api/media/generate — 异步生成图像、视频、TTS、音乐和 3D。参数为 model、prompt、opts。使用 GET /api/media/jobs/{id} 进行轮询。
异步媒体生成:图像、视频、配音(TTS)、语音转文本、音乐和 3D。你需要创建任务并轮询结果。完整模型列表位于 media-models catalog;webhook、错误和计费信息位于 webhook section。
创建参数
| 参数 | 类型 | 描述 |
|---|---|---|
modelreq. | string | 媒体模型名称,例如 veo-3.1 或 gpt-image-2(参见 catalog)。 |
promptreq. | string | 文本描述。 |
opts | object | 其他生成选项(取决于模型):分辨率、时长等。 |
创建并轮询
创建操作返回 202 和 { ok: true, jobId, status: "processing" }。轮询 GET /api/media/jobs/{jobId} 直到 status: "success",然后获取 resultUrls。
# 1. create a generation job
curl https://getvibeapi.com/api/media/generate \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "veo-3.1",
"prompt": "a cat on a skateboard, slow motion"
}'
# → {"ok":true,"jobId":"...","status":"processing"}ok: false,且不会产生费用。网站价格仅供参考;每个已接受响应的 x-pv-cost-rub 标头中都会返回确切费用。默认情况下,流式响应正文不会改变;发送 x-pv-cost: 1 可将费用添加到该协议的最终 usage 事件中。高级参数(opts)
除了 model 和 prompt 外,还可以在 opts 中传递额外选项。可用选项取决于模型。完整的机器可读契约可通过 GET /api/model-capabilities 获取(特定模型则通过 GET /api/model-capabilities/{model} 获取)。
| 参数 | 类型 | 描述 |
|---|---|---|
aspect_ratio | string | Aspect ratio: 1:1, 16:9, 9:16, 4:3, 3:4. |
duration | string|number | 视频时长(秒)(5、10、15)。 |
resolution | string | Resolution: 480p, 720p, 1080p, 4K. |
image_url | 字符串(URL) | 用于 I2V / 图生图的源图片。 |
negative_prompt | string | 要从生成内容中排除的内容(qwen-image、wan-2-7)。 |
guidance | number | 引导强度 — 对提示词的遵循程度(flux-2、qwen-image、seedance)。 |
seed | number | 用于生成可复现结果的 Seed(flux-2)。 |
stability | number | 稳定性 0–1(hailuo、happyhorse、seedance、TTS)。 |
camera | string | 镜头运动,例如“向左平移”(kling-3.0、hailuo)。 |
first_frame_url | 字符串(URL) | First frame for I2V (kling-3.0, wan-2-7). |
last_frame_url | 字符串(URL) | I2V 的最后一帧(seedance、kling-3.0、wan-2-7)。 |
reference_image | 字符串(URL) | 风格/角色参考(happyhorse)。 |
similarity_boost | number | 声音相似度 0–1(ElevenLabs TTS)。 |
speed | number | 语速 0.5–2(ElevenLabs TTS)。 |
GET /api/model-capabilities/{model} 响应中。您自己的文件:使用 base64 而不是链接
URL 选项(image_url、input_urls、mask_url 等)是 provider 获取的链接,因此只接受公开的 https:// 地址。这些字段中的某个字段若包含内联 data:image/...;base64,… 字符串,将被拒绝并返回 400。
要发送自己的文件,请改用匹配的 *_base64 字段:服务会存储文件字节,发布文件,并将生成的链接传递给提供商。在 input_base64 中每个请求最多支持 16 个文件。
| 参数 | 类型 | 描述 |
|---|---|---|
image_base64 | string | 源图片。替代 image_url。 |
mask_base64 | string | 局部重绘蒙版(仅限 image/*)。替代 mask_url。 |
input_base64 | 字符串[] | 用于图生图和多输入的参考内容。替代 input_urls。 |
audio_base64 | string | 源音频。替代 audio_url。 |
video_base64 | string | 源视频。替换 video_url。 |
data:image/png;base64,… 字符串,文件类型会从其中读取。请求约定:strict、quote_id、max_price_rub
POST /api/media/generate 和 POST /api/media/price 接受相同的请求正文,因此你可以先获取报价,然后原样提交。不存在其他顶层字段:未知字段会在两个端点上被拒绝,并返回 400 以及指明该字段的代码 unknown_field(field、fields),无论是否使用 strict。生成参数应放在 opts 中。
| 参数 | 类型 | 描述 |
|---|---|---|
modelreq. | string | 公共模型 id 或其路由之一(base:alias)。 |
prompt | string | 文本;仅当模型操作需要时才必填。 |
opts | object | 模型选项。确切架构:GET /v1/model-capabilities/{model} 中的 operations[].requestJsonSchema。 |
strict | boolean | 严格模式(或请求头 x-getvibe-strict: 1):如果请求无法完全按照原样执行(参数被丢弃、值被限制在范围内、键超出模型契约),则会在生成报价或扣费前被拒绝,并返回 422 strict_validation_failed 及 violations 列表。对于模型接受但会忽略的已记录字段(源长度模型中的 duration),则不属于违规:系统会将其作为 param_ignored 警告返回。 |
quote_id | string | 来自 POST /api/media/price 的 mq_…。任务只会按该价格运行;过期、已使用或被重新路由的报价会在运行前被拒绝,并返回 409/422。 |
max_price_rub | number | 该账户货币下此项任务的价格上限。如果报价更高:返回 422 media_max_price_exceeded,且不会执行任何操作。计量任务的收费绝不会超过此上限。 |
webhook_url | string | 接收签名完成通知的公共 https URL。 |
按 id 获取文件(Files API)
任何源文件都可以通过三种方式发送:作为链接(image_url、audio_url、video_url…),作为内联字节(image_base64、audio_base64、video_base64…),或作为你自己的文件在 POST /v1/files 中返回的 id。id 字段会列在每个操作的 requestJsonSchema 中,并且在严格模式下也被接受。
| 参数 | 类型 | 描述 |
|---|---|---|
image_file_id | string | 替代 image_url。 |
audio_file_id | string | 替代 audio_url。 |
video_file_id | string | 替代 video_url。 |
mask_file_id | string | 替代 mask_url。 |
first_frame_file_id / last_frame_file_id | string | Instead of first_frame_url / last_frame_url. |
input_file_ids | 字符串[] | 追加到 input_urls。 |
reference_*_file_ids | 字符串[] | Appended to reference_image_urls / reference_audio_urls / reference_video_urls. |
按输入文件的时长计费
对于输出长度取决于所上传素材的模型——kling-ai-avatar、omnihuman-v2、omnihuman-2-0、omnihuman-v1.5、omnihuman-1-5、volcengine-lipsync(音频)、kling-motion-control、wan-animate、topaz-video-upscale、p-video-edit(视频)、lipsync-2-pro、sync-3、react-1(两个输入)——/api/media/price 和 /api/media/generate 上的 max_price_rub 预检会在服务器端测量该文件(link、data: URI、base64 或 *_file_id),并按测得的秒数计价。响应会携带 sourceSeconds(唇形同步为 outputSeconds),estimateReason 会说明时长已完成测量。如果无法读取文件,价格将沿用之前的计价依据(1 秒、目录估算值或路由最大值),并由 estimateReason 说明原因。费用为每秒费率 × 实际渲染的秒数,且绝不会超过 max_price_rub。这些模型会接受 opts.duration,但会忽略该参数,并发出 param_ignored 警告。
声音克隆
Create: { name, consent: true, engine, audio_url | audio_base64 } or several recordings samples: [{ audio_url } | { audio_base64 }, …] (engine: "elevenlabs" only). An ElevenLabs voice is used by voice-clone-tts and by the Voice Changer (elevenlabs-voice-changer). Appending recordings to an ElevenLabs voice is free. Every recording is downloaded and measured before the supplier is called: a refusal changes and charges nothing.
| 参数 | 类型 | 描述 |
|---|---|---|
one recording | ≤ 10 MB | wav/mp3, up to 60 s. Larger: 422 voice_sample_too_large / voice_sample_invalid. |
recordings per voice | ≤ 25 | 正在计算已添加的项目。更多信息:422 voice_samples_limit。 |
voice length | ≤ 300 s | 所有录音合计,包括已添加的录音。超过限制:422 voice_samples_limit;短于引擎最小要求:422 voice_samples_invalid。 |
recordings size | ≤ 50 MB | 同一请求的所有录音合计。更多信息:422 voice_samples_too_large。 |
request body | ≤ 70 953 644 B | 50 MB 的录音(以 base64 表示,×4/3)加上 JSON。更大的请求会返回 413 payload_too_large(JSON 中包含 max_body_bytes)。请通过 …/samples 分批发送较长的集合,或使用 audio_url 链接。 |
additions per 24 h | 20 | 按客户端计算。更多信息:429 voice_samples_rate_limited。 |
变声器和强制对齐
| 参数 | 类型 | 描述 |
|---|---|---|
elevenlabs-voice-changer | model | opts.voice_id (your ElevenLabs voice) + the source recording opts.audio_url | audio_base64 | audio_file_id, up to 5 minutes. Priced on the measured length: 1 minute = 1000 characters. |
forced-alignment | model | prompt is the transcript, opts.audio_url | audio_base64 | audio_file_id the recording. Result: word timings in resultMeta.words and an SRT file in resultUrls. Priced per 1000 characters of text. |
沙盒:提交结果未知
如果供应商的启动确认未到达,任务会保持以下状态:status: "submitting",stage: "submission_unknown",errorCode: "media_submission_uncertain",failure.advice: "reconcile_first"。请继续轮询同一个 jobId,不要创建重复任务。要免费测试此路径,请使用 sandbox key 发送 POST /api/media/generate,并添加请求头 x-pv-sandbox-outcome: submission_uncertain。响应是正常的 202,并包含 jobId;轮询该任务时,前 60 秒会返回提交状态未知,之后会返回任务从未启动(failure.code: "submission_not_started",charged: false)。不会存储任何内容、不会向供应商发送任何内容,也不会产生费用。使用普通 key 搭配此请求头会返回 400 sandbox_outcome_requires_sandbox_key。
语音转文本(转录)
与其余生成请求使用相同的端点:将 STT 模型名称放入model,将prompt留为空字符串,并在opts.audio_url中传入录音。转录文本会在GET /api/media/jobs/{id}的resultText中返回;resultUrls保持为空,因为转录不会生成文件。
# speech-to-text: create the job, then read the transcript
curl https://getvibeapi.com/api/media/generate \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "whisper-large-v3-turbo",
"prompt": "",
"opts": {
"audio_url": "https://example.com/meeting.mp3",
"language_code": "en"
}
}'
# → {"ok":true,"jobId":"JOB_ID","status":"processing","priceRub":0.03}
curl https://getvibeapi.com/api/media/jobs/JOB_ID \
-H "Authorization: Bearer $GETVIBE_API_KEY"
# → {"status":"success","resultText":"the transcribed text…","resultUrls":[],"priceRub":0.03}模型
whisper-large-v3-turbo— 每分钟音频 $0.00025。价格最低、速度最快,支持 99 种语言。nemotron-asr-multilingual— 每分钟 $0.00025。NVIDIA 多语言 ASR,可自动添加标点。whisper-large-v3— 每分钟 $0.000563。完整 Whisper:比 turbo 慢,但对含噪音频更准确。universal-2— 每分钟 $0.003125。speech-to-text— 每分钟 $0.01(ElevenLabs Scribe)。支持说话人分离和音频事件标签。
参数
| 参数 | 类型 | 描述 |
|---|---|---|
audio_urlreq. | 字符串(URL) | 直接提供文件的公共 https 链接。拒绝重定向和私有网络地址。如果文件不在线,请改用 audio_base64。 |
audio_base64 | string | 以内联数据形式记录的音频:data:audio/mpeg;base64,…。替代 audio_url。 |
language_code | string | 语言代码(en、ru、…)。省略时会自动检测。 |
duration_minutes | number | 录音时长(分钟),用于预先估算价格。最终费用按实际用量计量(见下文)。 |
diarize | boolean | 说话人分离(universal-2,语音转文本)。 |
tag_audio_events | boolean | 标记笑声或掌声等音频事件(语音转文本)。 |
keyterms | 字符串[] | 术语和名称提示列表(语音转文本;价格 +30%)。 |
格式和限制
接受 mp3、wav、m4a/mp4、flac、ogg/opus 和 webm。文件大小最大为 25 MB,大约相当于 26 分钟的 128 kbps mp3,或数小时的 opus 语音。任何更大的文件都会立即被拒绝,并返回明确的消息,不会产生费用;请改为拆分录音。
whisper-large-v3-turbo、whisper-large-v3 和 nemotron-asr-multilingual,最终金额根据从转录内容中获取的录音实际测量时长计算,而不是根据你在 duration_minutes 中传入的值计算。最低收费为 1 戈比。完成的任务始终会通过 priceRub 返回确切金额。就绪 Webhook(替代轮询)
为避免轮询,请在仪表板中注册一个地址 mediaWebhookUrl。任务完成时(成功或错误),服务会对带有 JSON 请求体的 POST 最多尝试投递五次:
// POST to your mediaWebhookUrl when a job finishes
{
"jobId": "...",
"status": "success", // or "fail"
"model": "veo-3.1",
"kind": "video", // image | video | audio | music | 3d
"resultUrls": ["https://getvibeapi.com/api/media/file/..."],
"failMsg": null,
"createdAt": "2026-06-17T10:00:00.000Z"
}正在获取文件:/api/media/file/{id}/{idx}
来自 resultUrls 的生成结果 URL(图像、视频、音频或 3D 模型)。请按服务返回的方式使用它:无需 API key 即可打开,并可在 <img>、<video> 或浏览器中使用。提供商信息会被隐藏:上游地址在服务器端解析,客户端永远不会看到。
| 参数 | 类型 | 描述 |
|---|---|---|
idreq. | 字符串(路径) | 来自 /api/media/jobs/{id} 响应的任务 ID(jobId)。 |
idxreq. | integer(路径参数) | 结果索引(从 0 开始)。对于单个结果,值为 0。 |
query params | 与 resultUrls 中一样 | 不要自行构建 URL,也不要修改服务返回的参数。 |
download | 字符串(查询) | download=1 会将文件作为附件返回,其名称和扩展名遵循内容类型(3D 模型使用 .glb)。不设置该参数时,文件会在浏览器中打开。 |
# The signed URL is returned in resultUrls of the /api/media/jobs/{id} response
# or in the webhook body. Opens directly in the browser / <img> — no key needed.
https://getvibeapi.com/api/media/file/JOB_ID/0?sig=HMAC_SIGNATURE/api/media/jobs/{id} 的 resultsExpireAt 字段)。完成的文件会复制到我们的存储中,并且 resultUrls 会切换为 https://getvibeapi.com/media/r/… 形式的永久地址;之前返回的 /api/media/file/… URL 也会继续有效。两者都支持 Range 请求(用于在视频和音频中进行定位)。7 天后文件会被删除,URL 会以代码 media_result_expired 返回 410 Gone,请在此之前下载所需内容。