- Third-party
- Zero data retention
根据文本提示词生成可用于生产的 SVG 矢量图形,美学质量高,几何结构简洁,图层结构清晰,路径可编辑。
| 模型信息 | |
|---|---|
| 条款和许可证 | 链接 ↗ |
| 更多信息 | 链接 ↗ |
| 零数据保留 | 是 |
| 定价 | 在 Cloudflare 仪表板中查看定价 ↗ |
用法
const response = await env.AI.run(
'recraft/recraftv4-1-vector',
{ prompt: 'A simple flat icon of a coffee cup with steam rising' },
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "recraft/recraftv4-1-vector",
"input": {
"prompt": "A simple flat icon of a coffee cup with steam rising"
}
}'{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4-1-vector/simple-icon.jpg"
},
"state": "Completed"
}示例
应用图标 — 矢量格式的移动应用图标
const response = await env.AI.run(
'recraft/recraftv4-1-vector',
{
prompt: 'A colorful gradient app icon featuring a chat bubble with a sparkle effect',
size: '1024x1024',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "recraft/recraftv4-1-vector",
"input": {
"prompt": "A colorful gradient app icon featuring a chat bubble with a sparkle effect",
"size": "1024x1024"
}
}'{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4-1-vector/app-icon.jpg"
},
"state": "Completed"
}插画 — 适用于网页的矢量插画
const response = await env.AI.run(
'recraft/recraftv4-1-vector',
{
prompt:
'A flat vector illustration of a person working at a desk with a computer, plants, and a window showing a city view',
size: '1024x1024',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "recraft/recraftv4-1-vector",
"input": {
"prompt": "A flat vector illustration of a person working at a desk with a computer, plants, and a window showing a city view",
"size": "1024x1024"
}
}'
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4-1-vector/illustration.jpg"
},
"state": "Completed"
}使用品牌颜色 — 使用特定调色板的矢量图
const response = await env.AI.run(
'recraft/recraftv4-1-vector',
{
prompt: 'A badge or seal design with a star in the center, suitable for a certification mark',
controls: {
background_color: { rgb: [255, 255, 255] },
colors: [{ rgb: [0, 119, 182] }, { rgb: [255, 209, 102] }],
},
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "recraft/recraftv4-1-vector",
"input": {
"prompt": "A badge or seal design with a star in the center, suitable for a certification mark",
"controls": {
"background_color": {
"rgb": [
255,
255,
255
]
},
"colors": [
{
"rgb": [
0,
119,
182
]
},
{
"rgb": [
255,
209,
102
]
}
]
}
}
}'
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4-1-vector/with-brand-colors.jpg"
},
"state": "Completed"
}参数
prompt
stringrequiredsize
stringstyle
stringsubstyle
string▶controls{}
objectimage
string