Skip to content
Recraft logo

Recraft V4

Text-to-ImageRecraftProxied

Recraft V4 generates art-directed images with strong composition, accurate text rendering, and design taste built in. Fast and cost-efficient at standard resolution.

Model Info
Terms and Licenselink
More informationlink
PricingView pricing in the Cloudflare dashboard

Usage

TypeScript
const response = await env.AI.run(
'recraft/recraftv4',
{
prompt: 'A minimalist logo of a mountain range with a sun rising behind it',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Simple Generation

Examples

Scene Composition — Generate a complex compositional scene
TypeScript
const response = await env.AI.run(
'recraft/recraftv4',
{
prompt:
'A cozy cabin in the woods surrounded by tall pine trees, smoke rising from the chimney',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Scene Composition
Custom Size — Specify output dimensions
TypeScript
const response = await env.AI.run(
'recraft/recraftv4',
{
prompt:
'A flat illustration of a workspace with a laptop, coffee cup, and potted plant',
size: '1024x1024',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Custom Size
With Color Controls — Guide generation with specific brand colors
TypeScript
const response = await env.AI.run(
'recraft/recraftv4',
{
prompt:
'An abstract geometric pattern suitable for a tech company brand identity',
controls: {
colors: [
{
rgb: [255, 107, 53],
},
{
rgb: [0, 43, 91],
},
],
},
},
{
gateway: { id: 'default' },
}
)
console.log(response)
With Color Controls
Background Color — Set a specific background color
TypeScript
const response = await env.AI.run(
'recraft/recraftv4',
{
prompt: 'A clean icon of a lightning bolt',
size: '1024x1024',
controls: {
background_color: {
rgb: [245, 245, 245],
},
},
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Background Color

Parameters

prompt
stringrequired
size
string
style
string
substyle
string

API Schemas (Raw)

Input
Output