Skip to main content

Tech Cost Projections - Production Launch

Executive Summary​

This document provides detailed cost projections for the Toto ecosystem as user base grows. Costs are broken down by service category and include scaling scenarios from 1,000 to 100,000+ active users.

Key Cost Drivers:

  1. AI/ML Services (Google Gemini) - Largest variable cost
  2. Firebase App Hosting (Cloud Run) - Scales with traffic
  3. Firestore Database - Scales with data operations
  4. Firebase Storage - Scales with image/file uploads
  5. Email Services (SendGrid) - Scales with user engagement
  6. Payment Processing (Stripe) - Transaction-based fees

πŸ— Infrastructure Overview​

Firebase Projects​

  • toto-f9d2f - Main application (production)
  • toto-f9d2f-stg - Main application (staging)
  • toto-bo - Backoffice (production)
  • toto-bo-stg - Backoffice (staging)
  • toto-ai-hub - AI services
  • toto-wallet - Payment processing
  • toto-landing - Landing pages
  • toto-investors - Investor pages

Current Configuration​

toto-app (Production):

  • Min instances: 2
  • Max instances: 100
  • CPU: 2 vCPU
  • Memory: 1024 MiB
  • Concurrency: 100

toto-bo (Production):

  • Min instances: 1
  • Max instances: 10
  • CPU: 1 vCPU
  • Memory: 1024 MiB
  • Concurrency: 80

toto-ai-hub:

  • Min instances: 2
  • Max instances: 20
  • CPU: 2 vCPU
  • Memory: 2048 MiB
  • Concurrency: 100

πŸ’΅ Cost Breakdown by Service​

1. AI/ML Services (Google Gemini) πŸ”΄ HIGHEST COST​

Current Usage:

  • Gemini 2.0 Flash (primary, 85-90% of usage) - $0.075 per 1M input tokens, $0.30 per 1M output tokens
  • Gemini 2.0 PRO (complex tasks, 10-15% of usage) - $1.25 per 1M input tokens, $5.00 per 1M output tokens
  • Model Selection Service optimizes Flash vs PRO usage (saves 30-50%)

Realistic Token Usage per Interaction:

  • System prompt: 800-1,200 tokens (agent persona, rules, context)
  • User message: 100-200 tokens
  • Knowledge context (RAG): 200-500 tokens
  • Conversation history: 200-500 tokens (if multi-turn)
  • Average input: 1,200-2,200 tokens per interaction
  • Average output: 200-400 tokens per interaction

Estimated Usage per User:

  • 2-3 sessions per month
  • 2-3 AI interactions per session
  • Total: 6-9 AI interactions per user per month
  • Plus: Intent detection, image analysis, RAG retrieval

Monthly Cost Projections (Realistic Estimates):

UsersAI Interactions/MonthFlash (85%)PRO (15%)Monthly Cost
1,00010,0008,500 Γ— $0.0002851,500 Γ— $0.00575$14-50
5,00050,00042,500 Γ— $0.0002857,500 Γ— $0.00575$70-250
10,000100,00085,000 Γ— $0.00028515,000 Γ— $0.00575$140-500
25,000250,000212,500 Γ— $0.00028537,500 Γ— $0.00575$350-1,250
50,000500,000425,000 Γ— $0.00028575,000 Γ— $0.00575$700-2,500
100,0001,000,000850,000 Γ— $0.000285150,000 Γ— $0.00575$1,400-5,000

Note: Cost range reflects conservative (higher) vs realistic (lower) estimates. Actual costs depend on:

  • Token usage per interaction (varies with context size)
  • PRO model usage percentage (varies with conversation complexity)
  • Additional services (embeddings, vector search if enabled)

Cost Optimization (Already Implemented):

  • βœ… Model Selection Service (30-50% savings) - Automatically uses Flash for simple tasks
  • βœ… Semantic Caching (reduces duplicate queries) - Saves 10-20%
  • βœ… Function Calling (reduces token usage) - Saves 5-10%

Additional Optimization Opportunities:

  • ⚠️ Rate limiting per user (potential 20-30% savings)
  • ⚠️ Prompt optimization (potential 15-20% savings)
  • ⚠️ Context window management (potential 10-15% savings)

Annual Cost Range: $168 - $60,000 (1K - 100K users, realistic estimates)

For detailed AI cost breakdown, see: AI_COSTS_DETAILED.md


2. Firebase App Hosting (Cloud Run) 🟑 MEDIUM-HIGH COST​

Pricing:

  • CPU: $0.00002400 per vCPU-second
  • Memory: $0.00000250 per GiB-second
  • Requests: $0.40 per million requests
  • Minimum billable time: 100ms

toto-app Costs:

UsersAvg Requests/MonthAvg InstancesCPU HoursMemory HoursMonthly Cost
1,000500K2-5720360$180
5,0002.5M3-81,800900$450
10,0005M5-153,6001,800$900
25,00012.5M8-259,0004,500$2,250
50,00025M15-5018,0009,000$4,500
100,00050M25-10036,00018,000$9,000

toto-bo Costs (Lower Traffic):

UsersAvg Requests/MonthAvg InstancesMonthly Cost
1,00050K1-2$25
5,000250K1-3$125
10,000500K1-5$250
25,0001.25M2-8$625
50,0002.5M3-10$1,250
100,0005M5-10$2,500

toto-ai-hub Costs:

UsersAvg Requests/MonthAvg InstancesMonthly Cost
1,0006K2-3$50
5,00030K2-5$250
10,00060K2-8$500
25,000150K3-12$1,250
50,000300K5-20$2,500
100,000600K8-20$5,000

Total App Hosting Monthly: $255 - $16,500 (1K - 100K users)


3. Firestore Database 🟑 MEDIUM COST​

Pricing:

  • Document reads: $0.06 per 100K
  • Document writes: $0.18 per 100K
  • Document deletes: $0.02 per 100K
  • Storage: $0.18 per GiB/month
  • Network egress: $0.12 per GiB (first 10 GiB free)

Estimated Operations per User:

  • Reads: ~500/month (case views, user data, etc.)
  • Writes: ~50/month (updates, new data)
  • Storage: ~5MB/user (cases, images metadata, etc.)

Monthly Cost Projections:

UsersReads/MonthWrites/MonthStorage (GB)Monthly Cost
1,000500K50K5$330
5,0002.5M250K25$1,650
10,0005M500K50$3,300
25,00012.5M1.25M125$8,250
50,00025M2.5M250$16,500
100,00050M5M500$33,000

Cost Optimization:

  • βœ… Index optimization (reduces unnecessary reads)
  • βœ… Caching strategies
  • ⚠️ Consider: Data archival for old cases

Annual Cost Range: $3,960 - $396,000 (1K - 100K users)


4. Firebase Storage 🟒 LOW-MEDIUM COST​

Pricing:

  • Storage: $0.026 per GiB/month
  • Downloads: $0.12 per GiB (first 1 GiB free/day)
  • Uploads: $0.05 per GiB

Estimated Usage per User:

  • Average storage: 50MB/user (case images, profile photos)
  • Downloads: 200MB/user/month (image views)

Monthly Cost Projections:

UsersStorage (GB)Downloads (GB)Monthly Cost
1,00050200$30
5,0002501,000$150
10,0005002,000$300
25,0001,2505,000$750
50,0002,50010,000$1,500
100,0005,00020,000$3,000

Annual Cost Range: $360 - $36,000 (1K - 100K users)


5. Email Services (SendGrid) 🟒 LOW COST​

Pricing:

  • Free tier: 100 emails/day
  • Essentials: $19.95/month for 50K emails
  • Pro: $89.95/month for 100K emails
  • Additional: $0.20 per 1,000 emails over plan

Estimated Usage:

  • Welcome emails: 1 per new user
  • Transactional: 2-3 per active user/month
  • Notifications: 1-2 per active user/month

Monthly Cost Projections:

UsersEmails/MonthPlanMonthly Cost
1,0003,000Free$0
5,00015,000Essentials$20
10,00030,000Essentials$20
25,00075,000Pro$90
50,000150,000Pro + 50K$190
100,000300,000Pro + 200K$390

Annual Cost Range: $0 - $4,680 (1K - 100K users)


6. Payment Processing (Stripe) 🟑 TRANSACTION-BASED​

Pricing:

  • Standard: 2.9% + $0.30 per transaction
  • International: 3.9% + $0.30
  • ACH: 0.8% (max $5)

Estimated Usage:

  • Average donation: $50
  • Conversion rate: 5% of active users donate monthly
  • Average transactions per donor: 1.5/month

Monthly Cost Projections:

UsersDonorsTransactionsRevenueStripe Fees
1,0005075$3,750$109
5,000250375$18,750$544
10,000500750$37,500$1,088
25,0001,2501,875$93,750$2,719
50,0002,5003,750$187,500$5,438
100,0005,0007,500$375,000$10,875

Note: These are fees, not costs - they're deducted from revenue.

Annual Fee Range: $1,308 - $130,500 (1K - 100K users)


7. Error Monitoring (Sentry) 🟒 LOW COST​

Pricing:

  • Developer: Free (5K events/month)
  • Team: $26/month (50K events)
  • Business: $80/month (100K events)

Estimated Usage:

  • ~10 events per user per month (errors, warnings)

Monthly Cost Projections:

UsersEvents/MonthPlanMonthly Cost
1,00010KTeam$26
5,00050KTeam$26
10,000100KBusiness$80
25,000250KBusiness + Overage$380
50,000500KBusiness + Overage$880
100,0001MBusiness + Overage$1,880

Annual Cost Range: $312 - $22,560 (1K - 100K users)


8. Twitter API 🟒 LOW COST (if used)​

Pricing:

  • Basic: $100/month (10K tweets/month)
  • Pro: $5,000/month (1M tweets/month)

Estimated Usage:

  • Social media monitoring for guardians
  • ~100 monitored accounts
  • ~1,000 tweets analyzed/month

Monthly Cost: $100 (Basic plan sufficient for most scenarios)

Annual Cost: $1,200


9. Vertex AI Vector Search 🟑 OPTIONAL​

Pricing:

  • Index creation: $0.10 per GB indexed
  • Query: $0.10 per 1,000 queries
  • Storage: $0.10 per GB/month

Current Status: Optional (code supports it, but using in-memory by default)

If Enabled:

  • Estimated: 1M vectors, 10K queries/month
  • Monthly Cost: ~$200

πŸ“Š Total Monthly Cost Summary​

Note: AI costs shown as ranges (realistic - conservative estimates)

UsersAI (Range)App HostingFirestoreStorageEmailSentryTwitterTOTAL (Range)
1,000$14-50$255$330$30$0$26$100$755-791
5,000$70-250$825$1,650$150$20$26$100$2,841-3,021
10,000$140-500$1,650$3,300$300$20$80$100$5,590-5,950
25,000$350-1,250$4,125$8,250$750$90$380$100$14,045-14,945
50,000$700-2,500$8,250$16,500$1,500$190$880$100$28,120-29,920
100,000$1,400-5,000$16,500$33,000$3,000$390$1,880$100$56,270-60,870

Annual Cost Range: $9,060 - $730,440 (1K - 100K users, realistic estimates)

Key Changes from Previous Estimates:

  • AI costs updated to reflect realistic token usage patterns
  • Lower end of range represents typical usage with optimizations
  • Higher end represents conservative estimates with buffers
  • See AI_COSTS_DETAILED.md for detailed breakdown

🎯 Cost Optimization Strategies​

Immediate Actions (Already Implemented)​

  1. βœ… Model Selection Service - Saves 30-50% on AI costs
  2. βœ… Function Calling - Reduces token usage
  3. βœ… Semantic Caching - Avoids duplicate AI queries
  1. AI Cost Optimization:

    • Implement rate limiting per user (e.g., 10 AI interactions/day free, then paid)
    • Add usage quotas for premium features
    • Cache common queries/responses
    • Consider batch processing for non-real-time tasks
  2. Firestore Optimization:

    • Implement data archival for cases older than 1 year
    • Use composite indexes efficiently
    • Batch operations where possible
    • Consider read replicas for heavy read workloads
  3. App Hosting Optimization:

    • Right-size min instances based on actual traffic patterns
    • Implement CDN caching for static assets
    • Optimize bundle sizes to reduce cold start times
    • Use regional deployments to reduce latency
  4. Storage Optimization:

    • Implement image compression/optimization
    • Use CDN for frequently accessed images
    • Archive old images to cheaper storage tiers
    • Implement lazy loading for images
  5. Email Optimization:

    • Batch notifications where possible
    • Implement email preferences (reduce unnecessary emails)
    • Use transactional email templates efficiently

πŸ“ˆ Growth Scenarios​

Conservative Growth (Year 1)​

  • Month 1-3: 1,000 users β†’ $1,191/month
  • Month 4-6: 5,000 users β†’ $5,021/month
  • Month 7-9: 10,000 users β†’ $9,950/month
  • Month 10-12: 15,000 users β†’ ~$14,000/month

Year 1 Total: ~$90,000

Moderate Growth (Year 1)​

  • Month 1-2: 1,000 users β†’ $1,191/month
  • Month 3-4: 5,000 users β†’ $5,021/month
  • Month 5-6: 10,000 users β†’ $9,950/month
  • Month 7-8: 25,000 users β†’ $24,945/month
  • Month 9-12: 50,000 users β†’ $49,920/month

Year 1 Total: ~$240,000

Aggressive Growth (Year 1)​

  • Month 1: 1,000 users β†’ $1,191/month
  • Month 2-3: 5,000 users β†’ $5,021/month
  • Month 4-5: 10,000 users β†’ $9,950/month
  • Month 6-7: 25,000 users β†’ $24,945/month
  • Month 8-9: 50,000 users β†’ $49,920/month
  • Month 10-12: 100,000 users β†’ $101,870/month

Year 1 Total: ~$600,000


⚠️ Cost Risk Factors​

High Risk:​

  1. AI Usage Spikes - Viral content could cause 10x AI usage
  2. Storage Growth - Image-heavy cases could exceed estimates
  3. Database Scaling - Complex queries could increase Firestore costs

Medium Risk:​

  1. Traffic Spikes - Marketing campaigns could spike App Hosting costs
  2. Email Volume - Notification preferences could increase email costs

Mitigation:​

  • Set up billing alerts at 50%, 75%, 90%, 100% of budget
  • Implement usage quotas and rate limiting
  • Monitor costs daily during launch period
  • Have cost optimization plan ready

πŸ“‹ Monitoring & Alerts​

  • Daily Budget: Set at 1/30th of monthly budget
  • Weekly Budget: Set at 1/4th of monthly budget
  • Monthly Budget: Set based on user growth projections

Key Metrics to Track:​

  1. AI token usage (input/output split)
  2. Firestore read/write operations
  3. App Hosting instance hours
  4. Storage growth rate
  5. Email send volume
  6. Error rate (Sentry events)

πŸ”„ Review Schedule​

  • Weekly: Review cost trends and anomalies
  • Monthly: Compare actual vs projected costs
  • Quarterly: Update projections based on actual growth
  • Annually: Comprehensive cost optimization review

πŸ“ž Support & Questions​

For questions about cost projections:

  • Technical Issues: Review Firebase/Google Cloud billing console
  • Optimization Ideas: Review this document's optimization strategies
  • Budget Planning: Use growth scenarios as starting point

Last Updated: January 2025
Next Review: Quarterly
Status: πŸ“Š Active Monitoring