跳转到内容
搜索文档
Recraft logo

Recraft V4 SVG

Text-to-Image • Recraft

查看 MarkdownAgent 设置
  • Third-party
  • Zero data retention

Generate production-ready SVG vector graphics from text prompts with clean geometry, structured layers, and editable paths.

Model Info
Terms and Licenselink ↗
More informationlink ↗
Zero data retentionYes
PricingView pricing in the Cloudflare dashboard ↗

Usage

const response = await env.AI.run(
  'recraft/recraftv4-vector',
  { prompt: 'A simple flat icon of a coffee cup with steam rising' },
)
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-vector",
  "input": {
    "prompt": "A simple flat icon of a coffee cup with steam rising"
  }
}'
Simple Icon
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/recraft/recraftv4-vector/simple-icon.svg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

Examples

App Icon — Mobile app icon in vector format
const response = await env.AI.run(
  'recraft/recraftv4-vector',
  {
    prompt: 'A colorful gradient app icon featuring a chat bubble with a sparkle effect',
    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-vector",
  "input": {
    "prompt": "A colorful gradient app icon featuring a chat bubble with a sparkle effect",
    "size": "1024x1024"
  }
}'
App Icon
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/recraft/recraftv4-vector/app-icon.svg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}
Illustration — Vector illustration for web use
const response = await env.AI.run(
  'recraft/recraftv4-vector',
  {
    prompt:
      'A flat vector illustration of a person working at a desk with a computer, plants, and a window showing a city view',
    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-vector",
  "input": {
    "prompt": "A flat vector illustration of a person working at a desk with a computer, plants, and a window showing a city view",
    "size": "1024x1024"
  }
}'
Illustration
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/recraft/recraftv4-vector/illustration.svg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}
With Brand Colors — Vector with specific color palette
const response = await env.AI.run(
  'recraft/recraftv4-vector',
  {
    prompt: 'A badge or seal design with a star in the center, suitable for a certification mark',
    controls: {
      background_color: { rgb: [255, 255, 255] },
      colors: [{ rgb: [0, 119, 182] }, { rgb: [255, 209, 102] }],
    },
  },
)
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-vector",
  "input": {
    "prompt": "A badge or seal design with a star in the center, suitable for a certification mark",
    "controls": {
      "background_color": {
        "rgb": [
          255,
          255,
          255
        ]
      },
      "colors": [
        {
          "rgb": [
            0,
            119,
            182
          ]
        },
        {
          "rgb": [
            255,
            209,
            102
          ]
        }
      ]
    }
  }
}'
With Brand Colors
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/recraft/recraftv4-vector/with-brand-colors.svg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

Parameters

prompt
stringrequired
size
string
style
string
substyle
string
image
string

API Schemas (Raw)

Input
Output

这篇文档对您有帮助吗?