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', }, { gateway: { id: 'default' }, })console.log(response)
{ "state": "Completed", "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/simple-generation.png" }, "gatewayMetadata": { "keySource": "Unified" }}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', }, { gateway: { id: 'default' }, })console.log(response)
{ "state": "Completed", "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/scene-composition.png" }, "gatewayMetadata": { "keySource": "Unified" }}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', }, { gateway: { id: 'default' }, })console.log(response)
{ "state": "Completed", "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/custom-size.png" }, "gatewayMetadata": { "keySource": "Unified" }}With Color Controls — Guide generation with specific brand colors
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)
{ "state": "Completed", "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/with-color-controls.png" }, "gatewayMetadata": { "keySource": "Unified" }}Background Color — Set a specific background color
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)
{ "state": "Completed", "result": { "image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/recraft__recraftv4/background-color.png" }, "gatewayMetadata": { "keySource": "Unified" }}Parameters
stringrequiredstringstringstringobjectstring