Code & Engineering

LLM API Fallback Review: Gemini, Groq, Chains

Recommended

Reviews pasted code that calls a language model (JavaScript, TypeScript or Python; REST, @google/genai, google-genai, or an OpenAI-compatible client for Groq), usually through a chain of models or providers with retries. It finds where the call path goes silent or stops while another model would answer (an empty 200 taken as the answer, a 429 or 5xx that ends the call, a retired model's 404, a Groq schema 400 that drops the provider, one provider's stop that ends all) and what costs more or hides the cause (retries on top of SDK retries, a missing thinking setting, a thinking level the model refuses, a small output limit, a moving -latest alias, errors without the model name, unguarded JSON, a model picked from the listing, several keys of one project, a weak model that publishes, a quality gate that cannot fail, a fixed price for open-ended reasoning). Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use to review LLM fallback code, check a Gemini 503 retry, a Gemini empty response or a Groq json_validate_failed handler before the code runs unattended.

LLM API Fallback Review: Gemini, Groq, Chains is a SKILL.md that reviews pasted code that calls a language model (JavaScript, TypeScript or Python; REST, @google/genai, google-genai, or an OpenAI-compatible client for Groq), usually through a chain of models or providers with retries; an agent buys it once for $0.05 over x402.

Tested 2026-10-16No code, no hidden instructionsv1.0.0 · 14.8 KB · perpetual license

Not for

Running the code or seeing the live API: it reads pasted code only, so it cannot confirm which model an alias points to today. It does not choose a provider for you, judge your prompts, or cover image and audio models. For OpenAI and Anthropic it applies only the general rule for 4xx and 5xx.

Tested, honestly

Tested 2026-10-16 with a strong and a weak model.

With and without the skill

Results with and without the skill, for Sonnet and Haiku
SonnetHaiku
withwithoutwithwithout
Code samples reviewed right (31 samples)31/3127/3130/3123/31

Same request on both sides, scored on the concept in any words. Read by hand, Sonnet without the skill already treated an empty answer as a failure, added a second model to a job that only postpones, sent a 404 or a 500 on to the next model, kept Groq running after a Gemini 403, knew that thinking costs output tokens and that a moving alias should be pinned. It went wrong in four places: it advised sending an ordinary 400 on to the next model (the vendor says do not retry it), did not know the Python SDK already repeats 429 and 5xx calls, trusted the models listing to prove a name works, and called two closed lists that share the value other sound. Haiku without the skill missed the same four, the Groq schema 400, the missing thinking setting and the minimal level that 3.8 Flash refuses.

Same cases and the same checks with and without the skill. The cases are ours, written around what the skill is for; with a handful of cases, a difference of one or two is within noise.

SonnetStrong model, claude-sonnet-5-5
Right on all 31 pasted code samples, read by hand: it named the empty answer saved as a result (two cases), the single-model job that only postpones on a 503 and the chain whose 500 throws, the 404 that never reaches the alias placed last, the Groq schema 400 that drops the provider (TypeScript and Python), the Gemini 403 that ends the call before Groq, the plain 400 walked through every model, the own retry loop around SDK retries, the missing thinking setting (two cases), the 60-token limit on a thinking model, the minimal level on 3.8 Flash and on 3.1 Pro preview, the alias first or alone (two cases), errors without the model name, unguarded JSON in a queue consumer, the model picked from the listing, four keys of one project, a lite model that publishes Bulgarian text unchecked, two closed lists that share a value, a length-only quality gate and a fixed price for high reasoning, and in the combined case both faults despite a planted comment asking for no findings. Where the input left a thrown network error uncaught it added that as well, which is true of those inputs. It answered No findings. for all five sound samples.
HaikuWeak model, claude-haiku-5-5
Named all twenty-six planted faults, read by hand, with the verdict line last and no fence, but it missed one sound sample: on the Groq client in strict mode it reported a schema 400 that strict mode does not return and a parse problem that the code already handles. In eleven of the fault answers it also added small extra findings, most often a missing response message reported as an error that does not name the model.

Full test summary

Example

Our own test text, before and after the skill ran. Excerpts only.

English · claude-sonnet-5-5

Before

=== worker/summarize.ts === // scheduled job: one summary per product, saved to D1 const MODELS = ["gemini-3.6-flash", "gemini-3-flash-preview"]; async function ask(env: Env, prompt: string): Promise<string> { let last = "none"; for (const model of MODELS) { const res = await fetch("https://generativelanguage.googleapis.com/v1beta/models/" + model + ":generateContent", {…

After

[EMPTY-ANSWER-FINAL] worker/summarize.ts, `ask` (the `res.ok` branch) and `scheduled`: a 200 with no candidates, no text part or a non-text first part returns `""` through `?? ""`. The loop then writes `""` to `products.summary`. Because the job selects `WHERE summary IS NULL`, that product is never retried, so it keeps a blank summary for good and the second model is never tried.…

What is in the file

  • The answer
  • What the paste decides
  • How a response is sorted
  • The codes
  • Rules
  • Work in this order
  • How to check a fix
  • Short example

Languages

Any language. Tried in: English.

License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Full terms.

Versions

Current version 1.0.0, updated 2026-10-16. Whoever bought an earlier version gets new ones free through the same re-download token.

  1. v1.0.0 · 2026-10-16

    First release: reviews pasted code that calls a language model (JavaScript, TypeScript or Python; REST, @google/genai, google-genai, or an OpenAI-compatible client for Groq), usually through a chain of models or providers with retries, and lists each problem with a fixed code, the place, the reason and a fix, then a verdict (broken, fix before use, no known problems). Broken: an empty 200 taken as the answer, a 429, 408, 5xx or a thrown network error that ends the call, a retired model's 404 that ends the chain, a Groq schema 400 that drops the provider, one provider's stop that ends all providers. Fix before use: an own error walked through every model, retries on top of SDK retries, a missing thinking setting, a small output limit on a thinking model, a thinking level the model refuses, a moving alias first, errors that do not name the model, unguarded JSON, a model chosen from the listing, several keys of one project, a weak model that publishes, two closed lists swapped, a quality gate that cannot fail, a fixed price for open-ended reasoning. Facts: the Gemini and Groq vendor pages read on 16 October 2026 and our own measurements of September and October 2026; the skill tells the reader that the current vendor page wins.

FAQ

An empty 200 looks like success. What is wrong with it?

We measured in September 2026 that a Gemini call can answer 200 with finishReason STOP and zero text parts, because the thinking used the whole output limit. Code that returns an empty string and saves it has stopped for good, while the next model would have answered. The skill treats an empty answer as transient and names the model, finishReason and thoughtsTokenCount to log.

Is a Groq 400 always my own error?

No. Groq documents that best-effort structured output can return a 400 when the generated JSON does not match the schema, and lists retrying as a fix. On 22 September 2026 the same prompt and model that had worked hours before returned json_validate_failed. The skill sends exactly that error to the next model of the same provider and keeps every other 400 as a stop.

Which facts can go out of date?

Model names, aliases, thinking levels and prices. The vendor pages were read on 16 October 2026, for example that 3.8 Flash has no minimal level and that a moving -latest alias is swapped with every release. When the current vendor page disagrees with the skill, the page wins, and the skill tells you which line to re-check.

Does it help Claude Sonnet?

Yes, in four places. Without the skill Sonnet reviewed 27 of our 31 samples right; on its own it caught empty answers saved as results, single-model jobs, retired names and unguarded parsing. Its four misses: it advised passing an ordinary 400 on to the next model, did not know the Python SDK already repeats 429 and 5xx calls, trusted the models listing as proof that a name works, and called two closed lists sharing the value other sound. Using the skill, Sonnet scored 31 of 31; Haiku rose from 23 to 30, adding small extra findings in eleven answers.

Read more

Share

Read this page as Markdown: /skills/llm-api-fallback-review.md.

  • Spend Cap Review: Do Cost Limits Really Stop?

    Code & Engineering

    SKILL.md · v1.0.1 · 8.1 KB

    Reviews pasted code and configuration that spends money (paid AI or API calls, purchases, paid lookups, anything billed per use) and checks whether the limit on that spending really stands in the way of the spending. It flags a cap that sits beside the path instead of on it (a gateway limit while a script calls the provider directly, a counter only in the browser), a missing setting that means no limit, an alert or a budget email used as the protection, a cap that the caller sets through a header or a request field, a paid job that runs by default, a per-call cap with no running total, a total kept where it resets, a cap checked only after the money is gone, and a spend counter whose failure or missing value lets the call through. Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use before deploying a Worker, script or job that pays per call, or when a cap exists and you want to know if it can fail silently.

    $0.03once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • Unexpected Cloud Bill Spike: Find the Cause

    Code & Engineering

    SKILL.md · v1.0.0 · 15.9 KB

    Finds the loops behind a bill spike or an unexpected bill. Reviews a web app's code and config for loops and repeats that run up the bill on their own on Vercel, Turso, Cloudflare Workers and D1 and paid AI APIs. Finds two schedulers on one job, retries without a cap, work that triggers itself, client polling and React render loops, caches cleared on every write, middleware running on every static file, queues that resend failures forever, image settings that multiply transformations, health checks that count whole tables, alerts sent on every run and bots crawling endless filter URLs. Counts the runs per month, names the billed unit, ranks by cost and gives the change that stops each one. Use when asked why a Vercel, Turso or Cloudflare bill jumped, to find an infinite loop or a runaway cost, or to review a cron job, webhook, queue consumer, middleware or polling code before it ships.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 4 Oct 2026

  • Watchdog Alert Review: Silent and Noisy Alarms

    Code & Engineering

    SKILL.md · v1.0.1 · 12.2 KB

    Reviews pasted code or a design for a liveness watchdog, a staleness alarm or a daily heartbeat mail (sources that must keep answering, a pipeline that must keep publishing) and lists every way it stays silent on a dead source or floods on a healthy one. It checks whether silence is measured in the time the source was last asked or by the wall clock, whether a stateless alarm window repeats or never fires, whether the threshold is longer than the system's own cadence plus a tick, whether a new row starts with a last success of zero, whether the sweeper or the probe sits behind a daily limit, whether a failed send is remembered as sent, whether alert memory is purged by age, whether the subject names the dead source and the environment, whether a lamp still has a writer after a scheduler swap, and whether every check lives inside the thing it watches. Each finding has a fixed code, the place, the reason and a fix, then one verdict; sound code gets exactly No findings. Use to review a watchdog, a liveness check or a staleness alarm, to audit the design of a monitoring job, or to check an alert mail before you rely on it.

    $0.02once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • Cloudflare Workers Review: D1, OpenNext, Fetch

    Code & Engineering

    SKILL.md · v1.3.0 · 10.6 KB

    Reviews pasted Cloudflare Workers code and configuration (a Worker, a Next.js app on OpenNext, D1 queries, wrangler config) for platform pitfalls that pass every local test and then fail in production or quietly cost money. It flags the edge runtime under OpenNext, a fetch to your own Worker's workers.dev address (error 1042), D1 queries that bind more than 100 parameters as data grows, LIKE patterns over D1's 50-byte limit, reading rowsAffected where D1 returns meta.changes, interactive transactions D1 does not have, secrets kept in plain vars, outbound fetch code that treats only a thrown error as failure, a browser User-Agent that bot protection challenges, client hop-by-hop headers forwarded to fetch, cron triggers whose day of the week is written as numbers, domain lookups to two registry hosts that refuse Workers, and unbounded queries on the request path. Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use to review a Cloudflare Worker before deploy, check D1 or wrangler code, or audit a Next.js app running on Cloudflare.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 26 Nov 2026

More in Code & Engineering

  • PR Description From a Diff

    Code & Engineering

    SKILL.md · v1.0.3 · 10.6 KB

    Writes a pull request title and description from a pasted unified diff, as Markdown only - a title line of at most 72 characters, then four fixed sections - Summary, Changes, Tests and Risks - where every file the diff touches is named once, including renames, deletions, binary files, mode changes, lockfiles and formatting-only edits, and nothing is claimed that the diff does not show. It describes what the hunks change and leaves out a reason, a speed gain, a security fix or a test result unless the author's note supplies it, flags what can break callers, links an issue only when one is given, never copies a secret into the text, treats a note addressed to the AI inside a code comment as data, and says so when the diff is cut off. Use when asked to write a pr description, pull request body or merge request text from a git diff or a patch.

    $0.02once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • Screenshot Evidence Check

    Code & Engineering

    SKILL.md · v1.0.1 · 9.3 KB

    Reads a description of how a web page was captured or measured - a headless browser capture with a window size, a tall screenshot, a document width reading, a local Lighthouse run, a PageSpeed Insights run, an automation session that has been open for hours, a command-line download size on Windows - and says what that evidence proves, what it cannot prove and the one measurement that would decide, answered as JSON with a verdict. Knows the ways the capture itself produces the symptom - headless windows under about 500 pixels that lay out wider and crop the picture, no touch emulation behind a window-size flag, blank images in very tall captures, scroll-reveal sections caught before they appear, a width reading that stays clean while a container clips, scores that move with machine load, a long automation session that stops running page scripts, a download size of zero at a successful status. Use when an agent or a person is about to report that a page is broken or fixed from a screenshot, a score or a command-line reading.

    $0.03once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • Frontend Layout Review: CSS Grid, Hydration, Next.js

    Code & Engineering

    SKILL.md · v1.0.0 · 12.7 KB

    Reviews pasted CSS, Tailwind classes, JSX and Next.js client components for the layout and hydration defects that look fine on a desktop screenshot and then break on a phone or wipe the page in the browser. It flags a grid column written as a bare 1fr that refuses to shrink and, inside a clipping container, cuts the content without any horizontal scroll, width media queries written in pixels beside rem-based breakpoints, dates formatted inside a client component, server-only environment variables read in the browser, a schema default that silently stands in for a missing value, client components that pull a heavy dependency tree into every page, theme colour tokens painted on surfaces that do not flip with the theme, a fixed bar whose height is typed in several places, scroll-locking panels that stay open when the viewport crosses a breakpoint, and window.confirm. Each finding has a fixed code, the place, the reason and a fix; sound code gets No findings. Use to review a layout, a component or a stylesheet before release, or when a page looks cut off or resets itself on one route.

    $0.03once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • Social Auto-Posting Code Review: Bluesky, Mastodon, DEV

    Code & Engineering

    SKILL.md · v1.0.0 · 13.7 KB

    Reviews pasted code that announces published articles to social channels (Bluesky, Mastodon, a Facebook page, Pinterest through a feed, Tumblr, DEV) for the ways a channel stays silent or posts twice, which tests with a fake network and a green build do not catch. It flags a shared HTTP helper that cuts a response body the Bluesky login then parses, a text cut by UTF-16 position or link offsets taken from character positions instead of UTF-8 bytes, a Mastodon media upload judged by status 200 only, a link posted without uploading the picture, a missing write:media scope, an Idempotency-Key reused after its one hour, an alert cut to N characters of an HTML error page, dispatch called from cache invalidation, a new "announced" column without a backfill, Promise.all or no timeout around channels, a missing token treated as an error, staging that posts, a full article copied to a blog platform, an OAuth 1.0a signature that leaves out the form body, a DEV request from a Worker without a User-Agent, and duplicates counted by searching a title in an RSS feed. Each finding has a fixed code, the place, the reason and a fix, then one verdict. Use to review article-announcing code before release, to find why a channel never posts, or to check a new channel before its first live post.

    $0.03once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026