Repository navigation
fix: replace the retired Groq model and stop retrying dead providers - #8
Merged
Merged
Conversation
Production logs showed groq-1/groq-2 returning 404 on every call because Groq shut down llama-4-scout on 2026-07-17; its vision model is now qwen/qwen3.8-27b (JSON mode supported). Also drops thinkingmachines/inkling (403 'only available on agentic harnesses'), filters on the API key before building clients, disables the SDK's default 2 auto-retries (they hammer a rate-limited free tier) and adds a 30s timeout. A provider that fails with a retired model, no access, bad request, rate limit or unusable output is skipped for a while (honouring Retry-After), so later dimensions stop paying for it.
Unusable-output errors now carry finish_reason and a snippet so the log shows whether the model was cut off or answered in prose. Providers that document JSON mode get response_format json_object, max_tokens goes to 3000 for reasoning models, and the loop stops starting new dimensions after 85s so an audit finishes with a done event instead of hitting the 120s limit.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
This branch had an error being deployed
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.
What
Production logs (after #5/#6 deployed, thanks to the new failure logging) show why audits still come back mostly empty:
groq-1,groq-2meta-llama/llama-4-scout-17b-16e-instructdoes not existopenrouter-inklingopenrouter-gemma,-gemma-31bopenrouter-nemotronChanges:
qwen/qwen3.8-27b(Groq's vision model per its vision docs, preview, JSON mode supported, max 3 images/request) withresponse_format: json_object.openrouter-inkling.maxRetries: 0and a 30s timeout on every client. The SDK's default of 2 retries re-hit a rate-limited free tier and slowed every failure.Retry-Afteror 30s, unusable output for 60s), the provider is skipped, so later dimensions stop paying for it. If everything is cooling down, it still tries instead of failing without a call.finish_reasonand a 160-char snippet so the next log shows whether nemotron is being cut off, answering in prose, or putting everything in reasoning.max_tokens1800 -> 3000 for reasoning models; the audit loop stops starting new dimensions after 85s so it ends with adoneevent instead of hitting the 120s limit (the last live audit took 1m57s for 3 dimensions).Why
Live audit of stripe.com after #5/#6: dimension 1 was a real roast (via gemma), dimensions 2 and 3 failed on every provider, total 117s.
Type
Checklist
npx tsc --noEmitandnpx eslint lib/aipassRetry-Afterand its cap), a dimension after a failure skips dead providers, all-cooling-down still tries, cooldown expiryqwen/qwen3.8-27bis taken from Groq's docs, and the docs do not say whether it emits reasoning by default or how to hide it.parseDimensionJsonstrips<think>blocks, but if Groq returns it differently the new log line will show itnpm run buildnot run here (sandbox lacks Stripe/Resend env vars; see test: add Vitest suite covering AI fallback, rate limiter, audit scoring, admin auth #1)lib/ai/providers.ts(it contains an earlier version of the key-filter fix); this version supersedes itSources: Groq deprecations, Groq vision