Image Generation
AI image generation with reference images.
Overview
Image generation uses the Doubao image-to-image model, requiring a reference image as input.
Endpoint
POST /api/image/generateRequest
{
"prompt": "A futuristic city skyline",
"referenceImage": "base64-encoded-image-or-url",
"size": "1K"
}Supported Sizes
adaptive— Auto-detect from reference1K— 1024px2K— 2048px4K— 4096px
Response Flow
- Validate user session and credits
- Deduct 20 credits
- Send request to Volcano Engine
- Upload result to R2 storage (if configured)
- Save to
generationHistorytable - Return image URL
Storage
Generated images are uploaded to S3-compatible storage (Cloudflare R2) if configured. If storage is not available, the original Volcano Engine URL is used as a fallback.
History
All generations are tracked in the generationHistory table:
type—imageprompt— User's promptresultUrl— URL of generated imagestatus—completedorfailedcreditsUsed— Credits charged