More screenshots

    Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLI+17 more

    Nex Multi Llm Fallback Router

    by Nex AI

    5

    Builds a Python FallbackProvider that chains Claude, Gemini, Qwen, and Ollama so your AI pipeline never fully stops.

    Free

    1 installSecurity scanned

    See it in action

    You say

    I need a way to fall back to a local Ollama model if my Claude API calls fail or hit rate limits, so my data processing pipeline doesn't stop.

    Your agent does

    Structure generated:

    • fallback_provider.py: Implements try_next logic on AIProviderTimeout.
    • factory.py: Configures the chain [Claude -> Gemini (optional) -> Ollama].
    • base.py: Shared interface ensuring the router is indistinguishable from a single model caller.

    About this skill

    What it does

    • Generates fallback_provider.py, a FallbackProvider that wraps an ordered list of providers and tries them in turn, skipping any that times out, errors transiently, or returns invalid output
    • Ships base.py with the shared AIProvider interface and error taxonomy (AIProviderTimeout, AIProviderError, AIProviderInvalidOutput), identical across the companion provider skills
    • Ships factory.py with build_generation_chain() and build_scoring_chain(), the single place chain order lives, with graceful skipping of providers whose API key is missing
    • Default chain is Claude, then Gemini, then Qwen, then Ollama: strong paid, cheaper paid, cheap API, free local model
    • The router implements AIProvider itself, so it drops in anywhere a single provider was expected, and routers can nest

    Why use this

    One rate-limited API should not stall a bulk generation or scoring run; with this router the pipeline degrades to the next model instead of failing, down to a free local Ollama floor. This is the composition layer Nex AI runs in production, and because the router hides behind the same interface as every provider, adding failover to existing code is a one-line swap.

    See it in action

    Prompt:

    If Claude is down or rate-limited, I want it to fall back to Gemini automatically, and to a local model if both are out.

    Result:

    class FallbackProvider(AIProvider):
        def __init__(self, providers: list[AIProvider], label: str = "chain"):
            self.providers = providers
    
        def generate(self, prompt: str, **kwargs) -> str:
            last_error = None
            for provider in self.providers:
                try:
                    return provider.generate(prompt, **kwargs)
                except (AIProviderTimeout, AIProviderError,
                        AIProviderInvalidOutput) as e:
                    log.warning("provider %s failed, trying next", provider.name)
                    last_error = e
            raise last_error  # all failed: clean failure, never swallowed
    
    chain = build_generation_chain()  # Claude -> Gemini -> Ollama

    Use cases

    • Automatic failover when one model API has an outage or rate limit
    • A cost-aware scoring chain that starts cheap and escalates only on failure
    • A single AIProvider interface in front of multiple model vendors
    • Keeping overnight bulk jobs running on a local model when paid APIs are down

    Known limitations

    • Failover by priority, not load balancing; it does not round-robin for throughput.
    • The composition layer only: the individual Claude, Gemini, Qwen, and Ollama providers come from their own integration skills (constructor stubs are commented in factory.py).
    • Python only.

    FAQ

    What exactly is in the download?

    SKILL.md, assets/base.py, assets/fallback_provider.py, assets/factory.py, assets/requirements.txt, two reference docs (chain-design.md, shared-interface.md), manifest.json, README, changelog, and license.

    Which agents does it work with?

    Claude Code, Claude Cowork, Cursor, Codex CLI, and any agent that reads the SKILL.md format.

    Do I need anything else?

    The router itself has no dependencies beyond the providers it chains. You need API keys for the paid providers you wire in; a missing key skips that provider instead of crashing. Ollama needs your own hardware.

    Can I change the chain order?

    Yes, the factory is the only place the order is decided. Generation chains usually start at the strongest model; scoring chains start cheap and fall through to local, and the chain-design reference explains why.

    Changelog

    1. v1.2LatestAug 6, 2026

      v1.1: marketplace refresh. Added README with FAQ and known limitations, license, changelog, manifest metadata. Cleaned packaging for the security scan. No breaking changes to the skill workflow.

    2. v1.1Jul 13, 2026

      Refreshed audited build: manifest, README, worked examples and security declarations cleaned up.

    3. v1.0Jun 6, 2026

      Initial release

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    1 install

    Downloaded by developers to date

    Free forever

    No account required to browse

    Frequently Asked Questions

    Popular in AI Agents & LLM Ops

    Free