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 ↗ |
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)
Examples
With Style — Generate with a specific artistic style
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', style: 'realistic_image', }, { gateway: { id: 'default' }, })console.log(response)
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', style: 'digital_illustration', }, { gateway: { id: 'default' }, })console.log(response)
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)
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)
Parameters
stringrequiredstringstringstringobjectstringformat: uricontentMediaType: image/svg+xmlAPI Schemas
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string" }, "size": { "type": "string" }, "style": { "type": "string" }, "substyle": { "type": "string" }, "controls": { "type": "object", "properties": { "colors": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "rgb": { "minItems": 3, "maxItems": 3, "type": "array", "items": { "type": "integer", "minimum": 0, "maximum": 255 } } }, "required": [ "rgb" ], "additionalProperties": false } }, "background_color": { "type": "object", "properties": { "rgb": { "minItems": 3, "maxItems": 3, "type": "array", "items": { "type": "integer", "minimum": 0, "maximum": 255 } } }, "required": [ "rgb" ], "additionalProperties": false } }, "additionalProperties": false } }, "required": [ "prompt" ], "additionalProperties": false}{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "image": { "type": "string", "format": "uri", "contentMediaType": "image/svg+xml" } }, "required": [ "image" ], "additionalProperties": false}