|
| 1 | +/** |
| 2 | + * Per-provider free-tier quotas — what limits the user is likely hitting. |
| 3 | + * Reference text shown alongside the provider in Settings + StatusBar tooltip. |
| 4 | + * |
| 5 | + * These are documented public limits as of late 2025. They change; we update |
| 6 | + * when users report mismatch with reality. Not enforced client-side — the |
| 7 | + * provider returns 429 when exceeded; this is just *informational*. |
| 8 | + */ |
| 9 | + |
| 10 | +export interface ProviderLimits { |
| 11 | + providerId: string; |
| 12 | + /** Concise one-line summary. Shown inline next to the model picker. */ |
| 13 | + summary: string; |
| 14 | + /** Detailed bullets for tooltips / docs links. */ |
| 15 | + details: string[]; |
| 16 | + /** Whether the provider offers a free tier at all. */ |
| 17 | + has_free_tier: boolean; |
| 18 | + /** Public docs URL where the user can confirm current limits. */ |
| 19 | + docs_url: string; |
| 20 | +} |
| 21 | + |
| 22 | +export const PROVIDER_LIMITS: Record<string, ProviderLimits> = { |
| 23 | + anthropic: { |
| 24 | + providerId: "anthropic", |
| 25 | + summary: "Paid only — no free tier. $5 minimum top-up, $0/mo if unused.", |
| 26 | + details: [ |
| 27 | + "Pay-as-you-go, no monthly minimum after first $5 top-up.", |
| 28 | + "Default tier-1 limits: 50 req/min, 40k input tokens/min for Sonnet.", |
| 29 | + "Higher tiers unlock automatically based on spend history.", |
| 30 | + ], |
| 31 | + has_free_tier: false, |
| 32 | + docs_url: "https://docs.anthropic.com/en/api/rate-limits", |
| 33 | + }, |
| 34 | + openai: { |
| 35 | + providerId: "openai", |
| 36 | + summary: "Paid only — $5 minimum top-up. No free tier.", |
| 37 | + details: [ |
| 38 | + "Tier-1 (≥$5 paid, <7 days old): 500 req/min for GPT-4.1 / GPT-5.", |
| 39 | + "Limits scale with billing history — tier-5 is 10,000 req/min.", |
| 40 | + "GPT-4.1-mini: cheapest paid tier, ~$0.40/M input.", |
| 41 | + ], |
| 42 | + has_free_tier: false, |
| 43 | + docs_url: "https://platform.openai.com/docs/guides/rate-limits", |
| 44 | + }, |
| 45 | + google: { |
| 46 | + summary: "FREE tier · 15 req/min · 1,500 req/day · 1M tokens/min on Gemini Flash.", |
| 47 | + providerId: "google", |
| 48 | + details: [ |
| 49 | + "Free tier (no credit card): 15 RPM, 1500 RPD, 1M TPM on Gemini 2.5 Flash.", |
| 50 | + "Gemini 2.5 Pro free: 5 RPM, 100 RPD, 250K TPM.", |
| 51 | + "429 'quota exceeded' = day or minute cap. Look at the retry-in seconds.", |
| 52 | + "Paid tier (with billing): 2000 RPM, no daily cap, 4M TPM.", |
| 53 | + ], |
| 54 | + has_free_tier: true, |
| 55 | + docs_url: "https://ai.google.dev/gemini-api/docs/rate-limits", |
| 56 | + }, |
| 57 | + groq: { |
| 58 | + providerId: "groq", |
| 59 | + summary: "FREE · 30 req/min · 14,400 req/day · 6,000 tokens/min on Llama 70B.", |
| 60 | + details: [ |
| 61 | + "Free tier: 30 RPM, ~14,400 RPD, 6,000 TPM on Llama 3.3 70B.", |
| 62 | + "Llama 3.1 8B has higher TPM (30,000) for short tasks.", |
| 63 | + "Mixtral 8x7B: 30 RPM but lower TPM. Avoid for long-context jobs.", |
| 64 | + "Hard quota — exhaust the daily cap and you wait until midnight UTC.", |
| 65 | + ], |
| 66 | + has_free_tier: true, |
| 67 | + docs_url: "https://console.groq.com/docs/rate-limits", |
| 68 | + }, |
| 69 | + cerebras: { |
| 70 | + providerId: "cerebras", |
| 71 | + summary: "FREE · 30 req/min · 60,000 tokens/min on Llama 70B.", |
| 72 | + details: [ |
| 73 | + "Free tier: 30 RPM, 60,000 TPM on Llama 3.3 70B.", |
| 74 | + "Fastest tokens-per-second on the market (specialized hardware).", |
| 75 | + "Daily-token limits not publicly published — refresh on rate-limit error.", |
| 76 | + ], |
| 77 | + has_free_tier: true, |
| 78 | + docs_url: "https://inference-docs.cerebras.ai/introduction", |
| 79 | + }, |
| 80 | + openrouter: { |
| 81 | + providerId: "openrouter", |
| 82 | + summary: "FREE models · 20 req/min · 50/day on most :free variants.", |
| 83 | + details: [ |
| 84 | + "Models tagged ':free' (Llama 3.3 70B, DeepSeek V3): 20 RPM, 50 RPD.", |
| 85 | + "Free-tier accounts may face additional caps based on credit balance.", |
| 86 | + "Paid usage routes via your OpenRouter credit — buy credits separately.", |
| 87 | + ], |
| 88 | + has_free_tier: true, |
| 89 | + docs_url: "https://openrouter.ai/docs/api-reference/limits", |
| 90 | + }, |
| 91 | + together: { |
| 92 | + providerId: "together", |
| 93 | + summary: "Paid pay-as-you-go · select free models w/ daily quotas.", |
| 94 | + details: [ |
| 95 | + "Most models pay-per-token. Cheap rates (~$0.88/M for Llama 70B).", |
| 96 | + "A handful of 'free' models have daily quotas — check the model card.", |
| 97 | + "$5 free signup credit; expires.", |
| 98 | + ], |
| 99 | + has_free_tier: false, |
| 100 | + docs_url: "https://docs.together.ai/docs/rate-limits", |
| 101 | + }, |
| 102 | + deepseek: { |
| 103 | + providerId: "deepseek", |
| 104 | + summary: "Paid pay-as-you-go · cheapest serious reasoning model.", |
| 105 | + details: [ |
| 106 | + "DeepSeek V3: ~$0.27/M input, ~$1.10/M output. No free tier.", |
| 107 | + "DeepSeek R1 (reasoner): ~$0.55/M input, ~$2.19/M output.", |
| 108 | + "Default RPM: tier-based, ~60 RPM for new accounts.", |
| 109 | + ], |
| 110 | + has_free_tier: false, |
| 111 | + docs_url: "https://api-docs.deepseek.com/quick_start/rate_limit", |
| 112 | + }, |
| 113 | + mistral: { |
| 114 | + providerId: "mistral", |
| 115 | + summary: "Paid pay-as-you-go · €5 free credit on signup.", |
| 116 | + details: [ |
| 117 | + "Mistral Large: ~$2/M input, $6/M output.", |
| 118 | + "Mistral Small: ~$0.20/M input, $0.60/M output — recommended cost/quality.", |
| 119 | + "Default 60 RPM; multilingual + JSON output is a strength.", |
| 120 | + ], |
| 121 | + has_free_tier: false, |
| 122 | + docs_url: "https://docs.mistral.ai/deployment/laplateforme/tier/", |
| 123 | + }, |
| 124 | +}; |
| 125 | + |
| 126 | +export function getProviderLimits(providerId: string | null | undefined): ProviderLimits | null { |
| 127 | + if (!providerId) return null; |
| 128 | + return PROVIDER_LIMITS[providerId] ?? null; |
| 129 | +} |
0 commit comments