Fix Groq rate-limit handling: track TPD, fail fast on daily caps, replace deprecated llama-3.3-70b - #37
Merged
Conversation
…lace deprecated llama-3.3-70b Groq tightened its free tier and deprecated llama-3.3-70b-versatile / llama-3.1-8b-instant for the free/dev tier on 2026-06-17. Per-model RPD dropped from the 14,400 this codebase assumed to ~1,000, and Pass 2's full-article prompts now trip Groq's tokens-per-day cap (100K for llama-3.3-70b-versatile) after only a handful of articles — well before RPD-based call counting would notice anything wrong. - Track actual token usage per model/day (parsed from each provider's usage field) alongside call counts, and add MODEL_TPD_LIMITS so select_from_chain() can route around a TPD-exhausted model, not just an RPD-exhausted one. - call_llm now reads the Retry-After header on 429s: a short wait gets a sleep-and-retry, but a long or missing Retry-After (the signature of a daily cap, not a per-minute throttle) fails fast instead of burning the whole retry budget on a model that won't recover today. - Pass 2 (evaluate_article) now fails over to the next EVAL_CHAIN model mid-article on a 429, matching the pattern Pass 4's judge chain already used, instead of failing the whole article. - EVAL_MODEL/EVAL_CHAIN default to groq/gpt-oss-120b (Groq's recommended replacement, 200K TPD) ahead of the deprecated llama-3.3-70b-versatile, which is kept only as a fallback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBCHvm3HjoWbd1P7NuoZbN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Groq tightened its free tier and deprecated llama-3.3-70b-versatile /
llama-3.1-8b-instant for the free/dev tier on 2026-06-17. Per-model RPD
dropped from the 14,400 this codebase assumed to ~1,000, and Pass 2's
full-article prompts now trip Groq's tokens-per-day cap (100K for
llama-3.3-70b-versatile) after only a handful of articles — well before
RPD-based call counting would notice anything wrong.
usage field) alongside call counts, and add MODEL_TPD_LIMITS so
select_from_chain() can route around a TPD-exhausted model, not just
an RPD-exhausted one.
a sleep-and-retry, but a long or missing Retry-After (the signature
of a daily cap, not a per-minute throttle) fails fast instead of
burning the whole retry budget on a model that won't recover today.
mid-article on a 429, matching the pattern Pass 4's judge chain
already used, instead of failing the whole article.
replacement, 200K TPD) ahead of the deprecated llama-3.3-70b-versatile,
which is kept only as a fallback.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01LBCHvm3HjoWbd1P7NuoZbN