How Synthwave Studios Reduced AI Costs by 60% with Smart Caching
When Synthwave Studios launched their AI-powered game asset generator, they didn't anticipate the costs. Within three months, their AI spend had ballooned to $15,000/month—and they were only at 10% of their target user base.
Here's how they used Abstrakt to cut costs by 60% while actually improving performance.
The Challenge
Synthwave Studios builds tools for indie game developers. Their flagship product, AssetForge, generates game sprites, backgrounds, and UI elements using AI.
Initial Architecture
User Request → Direct API Call → AI Provider → Store Result → Return to UserEvery request hit the AI provider. No caching. No optimization.
The Numbers (Before)
The Solution
Working with our team, Synthwave implemented a three-layer optimization strategy.
Layer 1: Exact Match Caching
Many users generate similar assets. "Blue slime enemy pixel art" gets requested hundreds of times.
// Abstrakt's built-in caching
const result = await abstrakt.run('flux-schnell', {
prompt: 'Blue slime enemy, pixel art style, 32x32',
cache: {
enabled: true,
ttl: 86400 * 7 // 7 days
}
});Result: 35% of requests served from cache
Layer 2: Semantic Similarity Caching
"Blue slime monster pixel art" and "Blue slime enemy pixel art" should return similar results.
// Enable semantic caching for similar prompts
const result = await abstrakt.run('flux-schnell', {
prompt: userPrompt,
cache: {
enabled: true,
semantic: true,
similarityThreshold: 0.92
}
});Result: Additional 15% cache hits
Layer 3: Smart Model Selection
Not every generation needs the highest quality model.
// Thumbnails use fast model
if (outputSize <= 256) {
model = 'flux-schnell'; // 1 credit
}
// Full resolution uses quality model
else if (isPremiumUser) {
model = 'flux-pro'; // 5 credits
}
// Standard users get balanced model
else {
model = 'flux-dev'; // 2 credits
}Result: 25% cost reduction from model optimization
Implementation Timeline
The Results (After)
Code Walkthrough
Here's the actual implementation pattern Synthwave uses:
class AssetGenerator {
constructor() {
this.abstrakt = new Abstrakt({ apiKey: process.env.ABSTRAKT_KEY });
}
async generate(prompt, options) {
// Normalize prompt for better cache hits
const normalizedPrompt = this.normalizePrompt(prompt);
// Select model based on requirements
const model = this.selectModel(options);
// Generate with caching
const result = await this.abstrakt.run(model, {
prompt: normalizedPrompt,
image_size: options.size,
cache: {
enabled: true,
semantic: true,
similarityThreshold: 0.92,
ttl: 86400 * 7
}
});
// Track for analytics
await this.trackGeneration(result, options);
return result;
}
normalizePrompt(prompt) {
return prompt
.toLowerCase()
.trim()
.replace(/\s+/g, ' ')
// Standardize common variations
.replace(/monster|creature|enemy/g, 'enemy')
.replace(/sprite|character|asset/g, 'sprite');
}
selectModel(options) {
if (options.size <= 256) return 'flux-schnell';
if (options.premium) return 'flux-pro';
return 'flux-dev';
}
}Lessons Learned
1. Prompt Normalization is Crucial
Before normalization, these were all cache misses:
After normalization, they all hit the same cache entry.
2. Start with Exact Caching
Semantic caching is powerful but has edge cases. Start with exact matching, measure your cache hit rate, then add semantic if needed.
3. Monitor Everything
// Track cache performance
abstrakt.on('cache_hit', (event) => {
analytics.track('cache_hit', {
prompt: event.prompt,
savings: event.creditsSaved
});
});4. Set Appropriate TTLs
What's Next for Synthwave
With costs under control, they're now:
1. Scaling to 2M generations/month with confidence
2. Adding video generation for animated sprites
3. Building a prompt library of popular assets
Your Turn
Want to achieve similar results? Here's how to start:
1. Audit your current usage — identify repetitive prompts
2. Enable caching — start with exact matching
3. Implement model selection — match quality to use case
4. Monitor and iterate — track cache hit rates weekly
Questions about implementing caching for your use case? Reach out at enterprise@abstrakt.one.