- Third-party
- Zero data retention
Recraft V3 是 Recraft 的上一代文生图模型,非常适合设计级构图、契合品牌的图像以及准确的文字渲染。
| 模型信息 | |
|---|---|
| 条款和许可证 | 链接 ↗ |
| 更多信息 | 链接 ↗ |
| 零数据保留 | 是 |
| 定价 | 在 Cloudflare 仪表板中查看定价 ↗ |
用法
const response = await env.AI.run(
'recraft/recraftv3',
{ prompt: 'A minimalist logo of a mountain range with a sun rising behind it' },
)
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/recraftv3",
"input": {
"prompt": "A minimalist logo of a mountain range with a sun rising behind it"
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/recraft/recraftv3/simple-generation.png"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}示例
场景构图 — 生成复杂的构图场景
const response = await env.AI.run(
'recraft/recraftv3',
{
prompt: 'A cozy cabin in the woods surrounded by tall pine trees, smoke rising from the chimney',
},
)
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/recraftv3",
"input": {
"prompt": "A cozy cabin in the woods surrounded by tall pine trees, smoke rising from the chimney"
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/recraft/recraftv3/scene-composition.png"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}自定义尺寸 — 指定输出尺寸
const response = await env.AI.run(
'recraft/recraftv3',
{
prompt: 'A flat illustration of a workspace with a laptop, coffee cup, and potted plant',
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/recraftv3",
"input": {
"prompt": "A flat illustration of a workspace with a laptop, coffee cup, and potted plant",
"size": "1024x1024"
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/recraft/recraftv3/custom-size.png"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}使用颜色控制 — 使用特定的品牌颜色引导生成
const response = await env.AI.run(
'recraft/recraftv3',
{
prompt: 'An abstract geometric pattern suitable for a tech company brand identity',
controls: { colors: [{ rgb: [255, 107, 53] }, { rgb: [0, 43, 91] }] },
},
)
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/recraftv3",
"input": {
"prompt": "An abstract geometric pattern suitable for a tech company brand identity",
"controls": {
"colors": [
{
"rgb": [
255,
107,
53
]
},
{
"rgb": [
0,
43,
91
]
}
]
}
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/recraft/recraftv3/with-color-controls.png"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}背景颜色 — 设置特定的背景颜色
const response = await env.AI.run(
'recraft/recraftv3',
{
prompt: 'A clean icon of a lightning bolt',
controls: { background_color: { rgb: [245, 245, 245] } },
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/recraftv3",
"input": {
"prompt": "A clean icon of a lightning bolt",
"controls": {
"background_color": {
"rgb": [
245,
245,
245
]
}
},
"size": "1024x1024"
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/recraft/recraftv3/background-color.png"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}参数
prompt
stringrequiredsize
stringstyle
stringsubstyle
string▶controls{}
objectimage
string