curl --request POST \
--url https://api.vidgo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "recraft/v4.1/text-to-vector",
"input": {
"prompt": "Flat vector icon set of a hot air balloon, a brass compass and a mountain tent, rounded shapes, consistent stroke weight",
"size": "1:1"
}
}
'{
"code": 200,
"data": {
"task_id": "task-example-001",
"status": "not_started",
"created_time": "2026-11-25T10:30:00"
}
}{
"detail": "prompt is required"
}{
"detail": "prompt is required"
}Recraft
Recraft V4.1 文生矢量图
Recraft V4.1 文生矢量图 API 把提示词生成一个可编辑的 SVG 文件,支持 5 种宽高比、最多 10 个首选配色和背景色。
POST
/
api
/
generate
/
submit
curl --request POST \
--url https://api.vidgo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "recraft/v4.1/text-to-vector",
"input": {
"prompt": "Flat vector icon set of a hot air balloon, a brass compass and a mountain tent, rounded shapes, consistent stroke weight",
"size": "1:1"
}
}
'{
"code": 200,
"data": {
"task_id": "task-example-001",
"status": "not_started",
"created_time": "2026-11-25T10:30:00"
}
}{
"detail": "prompt is required"
}{
"detail": "prompt is required"
}- 提交后会返回
task_id。如果提供了callback_url,当任务状态变为finished或failed时,系统会向callback_url发送 POST 请求。 - 无论是否提供
callback_url,都可以通过统一的查询任务状态接口获取结果。
模型
- recraft/v4.1/text-to-vector — Recraft V4.1 Vector 文生 SVG,每次一个 SVG 文件。
功能
- 根据最多 10,000 个字符的提示词生成 SVG。
- 可编辑的矢量形状,可在任意矢量编辑器中调整形状和配色。
- 5 种宽高比:
1:1、4:3、3:4、16:9、9:16。 - 最多 10 个 RGB 颜色的首选配色,以及首选背景色。
- 每次请求一个 SVG 文件,按次固定计费。
必填参数
prompt(string):描述所需矢量图。1–10,000 个字符,至少包含一个非空白字符。
可选参数
size(string):宽高比,1:1、4:3、3:4、16:9或9:16。默认1:1。colors(object[]):首选配色,最多 10 个颜色。每个颜色是一个对象,例如{"r": 18, "g": 52, "b": 86},取值为 0–255 的整数。background_color(object):首选背景色,一个包含 0–255 整数r、g、b的 RGB 对象。
输出
任务完成后,查询任务状态和回调内容的files 数组中返回一个 SVG 文件。可在任意矢量编辑器中调整形状或重新配色,也可以直接嵌入网页。
示例
- 方形图标组:一个
1:1SVG 中的三个旅行图标。 - 带配色和回调的徽章:蜂鸟徽章,3 个
colors、白色background_color,并设置callback_url。
注意事项
- 每次请求只返回一个 SVG 文件。
input接收上文列出的字段,其他字段返回 400。model和callback_url放在请求根级,与input并列。 - 每个 RGB 对象只包含
r、g、b三个键,取值均为 0–255 的整数。其他颜色值或colors超过 10 项会返回 400。 - 每次请求按该模型 ID 的固定费率计费,
size、colors和background_color不影响价格。提交时预扣积分,任务失败会全额退还。当前费率见定价页。
请求体
application/json