CF Image Worker

Cloudflare AI · OpenAI-Compatible API

v1.0
Image
Response
History
n8n / Make.com
cURL / API
Generating image...

Enter a prompt and click Generate

Generated image
No response yet. Generate an image first.
No images generated yet
1

Add an HTTP Request node

In your n8n workflow, add an HTTP Request node.

2

Configure the request

Method: POST   URL: https://your-worker.workers.dev/v1/images/generations

3

Add Authorization header

Header Name: Authorization   Value: Bearer YOUR_API_KEY

4

Set the body (JSON)

{ "prompt": "{{ $json.prompt }}", "model": "@cf/black-forest-labs/flux-1-schnell", "n": 1 }
5

Read the image

Access the base64 image from: {{ $json.data[0].b64_json }}

Use a Move Binary Data node to convert it to a file, or pass it directly to other nodes.

curl -X POST https://your-worker.workers.dev/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A futuristic city at night", "model": "@cf/black-forest-labs/flux-1-schnell", "n": 1, "num_inference_steps": 4 }'
curl https://your-worker.workers.dev/health
curl https://your-worker.workers.dev/v1/models \ -H "Authorization: Bearer YOUR_API_KEY"
{ "created": 1700000000, "data": [ { "b64_json": "<base64-encoded-png>", "revised_prompt": "A futuristic city at night" } ], "model": "@cf/black-forest-labs/flux-1-schnell", "usage": { "prompt_tokens": 7, "total_tokens": 7 } }