Skip to content

Instantly share code, notes, and snippets.

@wangjohn
Created June 13, 2025 02:25
Show Gist options
  • Select an option

  • Save wangjohn/d366857bb80cf97cf7667dd571da122c to your computer and use it in GitHub Desktop.

Select an option

Save wangjohn/d366857bb80cf97cf7667dd571da122c to your computer and use it in GitHub Desktop.
LLM fallback article
type ModelCategory string
const (
Fast ModelCategory = "fast"
Smart ModelCategory = "smart"
Reasoning ModelCategory = "reasoning"
)
func GetModelForCategory(category ModelCategory, platform ModelPlatform) ModelType {
switch platform {
case ModelPlatformOpenAI:
switch category {
case Fast: return ModelTypeGPT4_1_Mini
case Smart: return ModelTypeGPT4_1
case Reasoning: return ModelTypeO_3
}
case ModelPlatformAnthropic:
switch category {
case Fast: return ModelTypeClaude3_5_Haiku
case Smart: return ModelTypeClaude4_Sonnet
case Reasoning: return ModelTypeClaude4_Opus
}
// ... additional platforms
}
return ModelTypeGPT_4_1 // sensible default
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment