Recraft V4
Text-to-Image • Recraft • ProxiedRecraft 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 License | link ↗ |
| More information | link ↗ |
| Pricing | View pricing in the Cloudflare dashboard ↗ |
Usage
const response = await env.AI.run( 'recraft/recraftv4', { 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/recraftv4", "input": { "prompt": "A minimalist logo of a mountain range with a sun rising behind it" }}'
{ "gatewayMetadata": { "keySource": "Unified" }, "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/simple-generation.png" }, "state": "Completed"}Examples
Scene Composition — Generate a complex compositional scene
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', },)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", "input": { "prompt": "A cozy cabin in the woods surrounded by tall pine trees, smoke rising from the chimney" }}'
{ "gatewayMetadata": { "keySource": "Unified" }, "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/scene-composition.png" }, "state": "Completed"}Custom Size — Specify output dimensions
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', },)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", "input": { "prompt": "A flat illustration of a workspace with a laptop, coffee cup, and potted plant", "size": "1024x1024" }}'
{ "gatewayMetadata": { "keySource": "Unified" }, "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/custom-size.png" }, "state": "Completed"}With Color Controls — Guide generation with specific brand colors
const response = await env.AI.run( 'recraft/recraftv4', { controls: { colors: [{ rgb: [255, 107, 53] }, { rgb: [0, 43, 91] }] }, prompt: 'An abstract geometric pattern suitable for a tech company brand identity', },)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", "input": { "controls": { "colors": [ { "rgb": [ 255, 107, 53 ] }, { "rgb": [ 0, 43, 91 ] } ] }, "prompt": "An abstract geometric pattern suitable for a tech company brand identity" }}'
{ "gatewayMetadata": { "keySource": "Unified" }, "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/with-color-controls.png" }, "state": "Completed"}Background Color — Set a specific background color
const response = await env.AI.run( 'recraft/recraftv4', { controls: { background_color: { rgb: [245, 245, 245] } }, prompt: 'A clean icon of a lightning bolt', 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", "input": { "controls": { "background_color": { "rgb": [ 245, 245, 245 ] } }, "prompt": "A clean icon of a lightning bolt", "size": "1024x1024" }}'
{ "gatewayMetadata": { "keySource": "Unified" }, "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/background-color.png" }, "state": "Completed"}Parameters
▶controls{}
objectprompt
stringrequiredsize
stringstyle
stringsubstyle
stringimage
string