litellm-rs: Skill for Claude Code

.claude/skills/routing-architecture/SKILL.md

routing-architecture is a skill for Claude Code from majiayu000/litellm-rs. It costs 72 tokens per session (1,733 once invoked), scanned A, original, MIT.

A guide to how LiteLLM-RS, a service that sends requests to different language-model providers, chooses among available provider-and-model deployments. It describes seven selection strategies, health checks, limits, fallbacks, and safe shared routing state.

In plain words
What is it for?
Use it when selecting or tuning a routing strategy, configuring failover between models, balancing traffic, applying cooldowns or request limits, or changing deployment and model state.
Why use it?
It helps developers understand or change which deployment receives each request, including what happens when a deployment is unhealthy or overloaded. It also explains how routing updates can happen without interrupting readers.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is majiayu000/litellm-rs's own configuration. It tells Claude Code how to work on litellm-rs itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything litellm-rs configures →

Reuse

Borrowing it

Nothing to install: this file belongs to majiayu000/litellm-rs. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/majiayu000/litellm-rs/main/.claude/skills/routing-architecture/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/majiayu000/litellm-rs

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for routing-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/majiayu000/litellm-rs/routing-architecture/github.svg)](https://agentmods.dev/skills/majiayu000/litellm-rs/routing-architecture)
Your own site
<a href="https://agentmods.dev/skills/majiayu000/litellm-rs/routing-architecture"><img src="https://agentmods.dev/badge/skills/majiayu000/litellm-rs/routing-architecture/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for routing-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/majiayu000/litellm-rs/routing-architecture"><img src="https://agentmods.dev/badge/skills/majiayu000/litellm-rs/routing-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,733 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00072 $0.01733
Opus 5 $0.00036 $0.00866
Sonnet 5 $0.00014 $0.00347
Haiku 4.5 $0.00007 $0.00173

Measured 12d ago against content hash 0933e737f1a8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

routing-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/routing-architecture/SKILL.md · 144 lines

How it starts

The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Routing Architecture Guide

Overview

The router (src/core/router/) selects among deployments — concrete provider+model pairs registered via Router::add_deployment / Router::set_model_list — using one of 7 strategies. There is no per-strategy router struct, no Router trait, and no create_router factory: strategy dispatch is a match on the RoutingStrategy enum calling free functions in src/core/router/strategy_impl.rs.

Key Design Principles

  • Snapshot isolation: deployments, the model index, and aliases live in an immutable RoutingSnapshot, published through ArcSwap (src/core/router/unified.rs:61,308). Readers load one generation lock-free; writers clone-modify-store under a parking_lot::Mutex that only serializes writers (unified.rs:312,379-398).
  • Atomic deployment state: per-deployment runtime state (DeploymentState) is plain atomics with Relaxed ordering (deployment.rs:210-252); RoundRobin uses a DashMap<String, AtomicUsize> of per-model counters (unified.rs:321).
  • Health-aware: candidates are filtered by cooldown, health status, parallel limits, and RPM/TPM limits before a strategy picks among them.
  • Fallback chains: the built-in execution path tries the model-keyed General fallback list after retries are exhausted. Typed context-window, content-policy, and rate-limit lists require explicit caller lookup/wiring today.

Selection Flow

Entry point Router::select_deployment_lease (selection.rs:95) delegates to select_deployment_matching (selection.rs:226). The real flow:

  1. Load the current snapshot; resolve model aliases via resolve_model_name (max MAX_ALIAS_HOPS = 16 hops, unified.rs:26).
  2. Look up the resolved model in snapshot.model_index to get candidate DeploymentIds.
  3. One filter pass builds Vec<RoutingContext> (strategy_impl.rs:17), skipping deployments that are in cooldown (is_in_cooldown), unhealthy (is_healthy), at their max_parallel_requests limit, or at their rpm_limit / tpm_limit (selection.rs:287-344). Each context copies weight, priority, active_requests, tpm_current/tpm_limit, rpm_current/rpm_limit, avg_latency_us.
  4. Router::select_from_routing_contexts dispatches on the configured strategy (selection.rs:195-224):

Read the full file on GitHub · 144 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 144 lines · 72 tokens per session scan A 0933e737f1a8

Subscribe to this mod's changes

routing-architecture is a skill published in the GitHub repository majiayu000/litellm-rs (112 stars, last pushed 3d ago), licensed MIT. It adds 72 tokens to every session and 1,733 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.