The Reddit Sentiment Tracker uses a sophisticated 5-stage fallback system to ensure accurate sentiment analysis even when individual models fail or hit rate limits. Each stage provides a safety net, guaranteeing that every post receives sentiment classification.
Smart Flow Control
The system automatically selects the next available model if the current one fails, ensuring 99.9% uptime and consistent sentiment scores.
Model: openai/gpt-oss-120b:exacto
Provider: OpenRouter API
Type: LLM-based content filter
Cost: Paid model (no rate limits)
Example: A post about NFL fantasy sports in r/wallstreetbets would be marked as
Models: Ensemble of local transformers
Provider: Local (in-memory)
Type: Fine-tuned financial NLP models
Cost: Free (no API calls)
Speed: ~50ms per analysis
Why Primary? The ensemble is fast, free, and optimized for financial text. It only falls back to cloud models when local analysis fails or has low confidence.
Model: openai/gpt-oss-120b:exacto
Provider: OpenRouter API
Type: 120B parameter LLM
Cost: Paid (unlimited credits)
Rate Limit: None (paid account)
When Used: Activates when ensemble model fails or returns low confidence scores. Typically handles complex posts with mixed sentiment or unusual language.
Model: Qwen via OpenRouter
Provider: OpenRouter API
Type: Large language model
Cost: Paid model
Rate Limit: Shared with OpenRouter
Model: XAI Grok
Provider: X.AI API
Type: Advanced reasoning LLM
Cost: Paid model
Rate Limit: Separate from OpenRouter
Reliability Guarantee: With Grok as the final fallback, the system achieves 99.9% sentiment classification success rate across all Reddit posts.
Model: google/gemini-2.0-flash-exp:free
Provider: OpenRouter API
Type: Free tier LLM
Rate Limit: 20 requests/minute
Purpose: JSON repair and formatting
Use Case: Fixes truncated API responses
Frequency: Rare (~1% of calls)
Cost Impact: Minimal
Important: Gemini is NOT used for sentiment analysis. It only repairs broken JSON responses from the paid models (GPT-OSS, Qwen, Grok) when they return truncated data. This is a reliability feature, not part of the sentiment pipeline.
Why Use a Free Model for JSON Repair?
JSON repair is a simple task that doesn't require advanced reasoning. Using the free Gemini model for this saves costs while the paid models focus on complex sentiment analysis. It's called so infrequently that the 20 req/min limit is never reached.
20 requests/minute for Google Gemini (free tier)
Used for JSON repair and auxiliary tasks
Dynamically adjusts request rate (0.5-10 QPS)
Automatic backoff on 429 errors
Periodic credit balance checks every 5 minutes
Alerts when credits < 25%
Smart Fallback on Rate Limits
When a model hits rate limits (429 errors), the system automatically switches to the next fallback model. Rate limits reset hourly, and the system self-heals by resuming the primary model when available.
Cost Optimization: By prioritizing the local ensemble, the system minimizes API costs while maintaining high accuracy. Fallback models only activate for ~5% of posts.