hook-model-fallback

Switch to a fallback model when the primary model fails with per-session tracking.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/xuezhaojun/oh-your-opencode --skill hook-model-fallback
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-model-fallback
Source: https://github.com/xuezhaojun/oh-your-opencode/tree/main/.opencode/skills/hook-model-fallback
Command: npx skills add https://github.com/xuezhaojun/oh-your-opencode --skill hook-model-fallback

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automatically switches to a fallback model when the primary model fails (rate limits, outages, or degraded responses), and tracks failure counts per session to reset on new sessions.

Core Features & Use Cases

  • Automatic fallback to pre-configured alternative models when the primary model is unavailable
  • Per-session failure tracking with reset on new sessions to maintain consistency
  • Simple integration with existing chat workflows via a small configuration snippet

Quick Start

Integrate the modelFallback hook into your chat workflow by importing modelFallback and initializing it with your fallbacks and retry settings.

Frequently Asked Questions about hook-model-fallback

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle model rate limits and outages in my chat workflow?

Model fallback automates switching to a pre-configured backup model when the primary model fails due to rate limits or outages, ensuring continuous chat workflow availability without manual intervention.

What is the best way to configure automatic model switching when an API fails?

The best way to configure automatic model switching is by integrating a hook that initializes with your chosen fallback models and retry settings, tracking failure counts to automatically trigger backups on demand.

Can I track model failure counts per session to reset retries automatically?

Yes, you can track model failure counts per session. This mechanism maintains consistency by automatically resetting the failure tracking and retry limits whenever a new chat session begins.

How does per-session failure tracking work for chat workflows?

Per-session failure tracking works by monitoring primary model errors within an active chat and resetting the failure counts when a new session starts, preventing permanent fallback states across unrelated conversations.

Do I need to manually switch models during intermittent API outages?

No, you do not need to manually switch models during intermittent API outages. The hook automatically detects primary model failures and transitions to configured alternative models based on your retry limits.

When should I not use an automatic model fallback in my application?

You should not use automatic model fallback if your application requires strict consistency from a single model, as it will automatically switch to a different backup model during rate limits or degraded responses.