Generating image...
Enter a prompt and click Generate
Response JSON
No response yet. Generate an image first.
Generation History (session only)
No images generated yet
Integration Guide
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 Examples
Generate Image (OpenAI format)
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
}'
Health Check
curl https://your-worker.workers.dev/health
List Models
curl https://your-worker.workers.dev/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
Response Format
{
"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
}
}