The Concept
The three strategies
1. API Models
Call a provider's API — they host the model, you pay per generation.
Providers: OpenAI (Sora, DALL-E), Google (Veo, Imagen), Midjourney, Suno, Kling, Runway, fal.ai (hosted models)
Pros:
- Fastest integration — just call an API
- No infrastructure to manage
- Per-generation cost, no idle costs
- Always up-to-date models
Cons:
- Limited control over model parameters
- Per-generation cost is high at scale
- Dependent on provider uptime
- Data leaves your infrastructure
Best for: Low-to-medium volume (< 1,000 images/day), quick launches, proprietary models (Sora, Veo)
2. Self-Hosted Models
Run open-weight models on your own GPU infrastructure.
Models: FLUX.1 Schnell/Dev (Apache 2.0/non-commercial), SDXL (open), MusicGen (MIT), Stable Audio 3 (open weights), Hunyuan3D (open source)
Pros:
- Full control over model and parameters
- No per-generation cost — pay for GPU time
- Data stays on your infrastructure
- Custom LoRAs, ControlNets, fine-tuning
Cons:
- Requires Docker packaging, GPU provisioning
- Idle GPU costs (pay even when not generating)
- Model updates require redeployment
- Need GPU expertise on team
Best for: High volume (> 667 images/day), custom LoRAs, privacy requirements, cost optimization at scale
3. Managed Platforms
Deploy custom models or workflows on serverless GPU infrastructure.
Platforms: fal.ai, Replicate, Modal, RunPod Serverless
Pros:
- Deploy custom models without managing infrastructure
- Per-second billing for GPU time
- Scale-to-zero when idle (no idle costs)
- Docker-based deployment
- ComfyUI workflow deployment
Cons:
- Slightly higher cost than pure self-hosting (~20-50% overhead)
- Cold start latency (2-10s when scaling from zero)
- Platform-specific deployment patterns
- Less control than pure self-hosting
Best for: Custom workflows, medium volume, ComfyUI deployment, teams without GPU ops expertise
A startup needs to generate 500 product images/day with a custom brand LoRA. They have no GPU ops expertise. Which deployment strategy is best?
A managed platform (fal.ai/Replicate) is ideal: they can deploy their custom LoRA as a Docker image, get per-second billing, scale-to-zero when idle (500 images = 2.5 GPU-hours/day = $5/day), and don't need GPU ops expertise. Self-hosting would require Docker/GPU knowledge and pay for idle time. API can't use custom LoRAs.
The 5-factor decision framework
Every deployment decision should consider these five factors:
| Factor | API | Self-Hosted | Managed |
|---|
| Volume | Low-Medium (< 667 img/day) | High (> 667 img/day) | Medium-High |
| Latency | 2-15s (provider-dependent) | 2-5s (dedicated GPU) | 2-10s + cold start |
| Cost | Per-generation (high at scale) | GPU-hour (low at scale) | Per-second (middle ground) |
| Control | Limited (provider's params) | Full (all parameters) | Full (Docker-based) |
| Licensing | Provider handles | You handle (check model license) | You handle (check model license) |
Decision Tree
Is volume < 100 generations/day?
→ YES: API (simplest, cheapest at low volume)
→ NO: Do you need custom LoRAs or ControlNet?
→ YES: Do you have GPU ops expertise?
→ YES: Self-hosted (cheapest at scale)
→ NO: Managed platform (fal.ai/Replicate)
→ NO: Is volume > 10,000 generations/day?
→ YES: Self-hosted (cost dominates)
→ NO: API or managed (depends on latency needs)
Hybrid deployment
Production systems often use hybrid deployment — different strategies for different modalities:
DEPLOYMENT_STRATEGY = {
"image_generation": {
"strategy": "self-hosted",
"model": "FLUX Schnell + brand LoRA",
"reason": "10,000 images/day, custom LoRA, cost optimization"
},
"video_generation": {
"strategy": "api",
"model": "Kling v2.6 via fal.ai",
"reason": "50 videos/day, no self-hostable model matches Kling quality"
},
"audio_generation": {
"strategy": "managed",
"model": "MusicGen on Replicate",
"reason": "100 songs/day, custom prompts, scale-to-zero overnight"
},
"3d_generation": {
"strategy": "api",
"model": "Tripo AI",
"reason": "10 models/day, no open-source model matches Tripo topology"
}
}
Platform comparison
| Platform | Strengths | Pricing | Best For |
|---|
| fal.ai | 600+ models, queue API, webhooks, ComfyUI | Per-generation or per-second | Quick integration, workflow chaining |
| Replicate | Simple Docker deployment, model registry | Per-second GPU | Custom model deployment |
| Modal | Python-native, serverless functions, cron | Per-second GPU | Python-heavy workflows, cron jobs |
| RunPod Serverless | Bare-metal GPU, lowest cost, worker pools | Per-second GPU | Cost optimization, high volume |
When to switch strategies
As your service grows, the optimal strategy changes:
0-100 gen/day: API (cheapest, simplest)
100-667 gen/day: API or managed (still cheaper than self-hosting)
667-10,000 gen/day: Managed or self-hosted (break-even crossed)
10,000+ gen/day: Self-hosted (cost dominates)
The switch from API to self-hosted typically happens at the break-even point (~667 images/day for FLUX Schnell). The switch from managed to self-hosted happens when you have enough volume to justify dedicated GPU ops.