# LLM gateway and routing

> LLM gateway and routing is an open-source agent skill for ai models and llm tooling. Gives an agent a plan for routing LLM calls across providers with fallbacks and schema. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/ajyadav013/claude-kit/tree/main/skills/llm-gateway-and-routing
- **Repository:** https://github.com/ajyadav013/claude-kit
- **GitHub stars:** 13
- **License:** MIT
- **Skill name:** llm-gateway-and-routing
- **Collection:** https://github.com/ajyadav013/claude-kit
- **Categories:** [AI models and LLM tooling](https://ai-powered.com/categories/ai-and-llm)
- **Listing updated:** 2026-12-03

## About

This skill guides an agent through designing the layer between an application and its model providers. It covers classifying requests so they reach an appropriately sized model, ordering fallback candidates, and handling provider failures by class, such as throttling, retired model IDs, safety refusals and malformed responses, instead of applying one retry policy to everything.

The guidance is organized as numbered conventions plus a request-path walkthrough. It explains how to score candidates on live health signals after policy filtering, how to keep retry and fallback budgets separate, how to re-validate fallback output against the same schema, and how to log which provider answered and why. It also covers model IDs as runtime configuration, deprecation calendar alerts, and cost attribution per route, including the fallback path.

The material expects a service that calls model providers and an engineer who can wire up the router, its config and its tests. It points to companion skills for tracing, resilience primitives, deprecation cutovers and API contract versioning rather than duplicating them, and it lists reference digests of the underlying articles.

## When your agent uses it

> Route application LLM traffic across providers — request tiering, fallback chains, health-aware failover, deprecation planning, and schema-constrained outputs. Use when a production service calls model providers on a path that must succeed.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/ajyadav013/claude-kit/tree/HEAD/skills/llm-gateway-and-routing)
- [License: MIT](https://github.com/ajyadav013/claude-kit/tree/HEAD/skills/llm-gateway-and-routing)

## Features

- **Failure class handling:** Maps provider errors such as 429, 5xx, 404 on retired models and safety refusals to distinct responses.
- **Tiered request routing:** Describes triaging requests into fast, mid and top model tiers with traffic-share targets.
- **Fallback chain design:** Covers ordering candidates by independence, filtering by policy, and scoring live health.
- **Schema as substitution contract:** Explains enforcing output schemas at the boundary so a fallback model's output stays usable.
- **Model deprecation planning:** Treats model retirement dates as scheduled events and keeps model IDs in runtime config.
- **Per-route cost attribution:** Logs routing decisions and slices cost, latency and retries per route, including fallback spend.

## Good for

- Add a second LLM provider as a fallback for a production feature
- Find and fix hardcoded model IDs that have announced retirement dates
- Design a fast and smart model split to reduce inference spend
- Make LLM responses that feed a database reliably match a schema
- Set up retry and failover behavior that stops retrying safety refusals

## Install

### Claude Code

This skill ships in the `claude-kit` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add ajyadav013/claude-kit
/plugin install claude-kit@claude-kit
```

Or copy only this skill to `~/.claude/skills/llm-gateway-and-routing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/llm-gateway-and-routing &&
cp -R "$tmp/skills/llm-gateway-and-routing" ~/.claude/skills/llm-gateway-and-routing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/llm-gateway-and-routing` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/llm-gateway-and-routing` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/llm-gateway-and-routing &&
cp -R "$tmp/skills/llm-gateway-and-routing" ~/.agents/skills/llm-gateway-and-routing &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/llm-gateway-and-routing` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/llm-gateway-and-routing` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/llm-gateway-and-routing &&
cp -R "$tmp/skills/llm-gateway-and-routing" ~/.cursor/skills/llm-gateway-and-routing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/llm-gateway-and-routing` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/ajyadav013/claude-kit.git --path skills/llm-gateway-and-routing
```

Or copy the folder to `~/.gemini/skills/llm-gateway-and-routing` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/llm-gateway-and-routing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/llm-gateway-and-routing &&
cp -R "$tmp/skills/llm-gateway-and-routing" ~/.copilot/skills/llm-gateway-and-routing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/llm-gateway-and-routing` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git
```

Then copy `claude-kit/skills/llm-gateway-and-routing` into your agent's skills folder as `llm-gateway-and-routing`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does LLM gateway and routing trigger?

It is meant for production services that call model providers on a path that must succeed, such as designing the call path, adding redundancy, or handling deprecations.

### Does LLM gateway and routing change which model my coding agent uses?

No. The skill explicitly separates application traffic routing from the model tier an SDLC agent runs on, which is governed by a different rule.

### Does LLM gateway and routing include scripts or tools?

The folder contains no scripts. It consists of guidance in SKILL.md and reference digests of source articles.

### Which tools does LLM gateway and routing require?

The skill does not set an allowed tools list, and the content does not name required tools beyond the provider and tracing skills it references.

### How do I install LLM gateway and routing in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/llm-gateway-and-routing to use it in all your projects, or to .claude/skills/llm-gateway-and-routing in one project. Or install the claude-kit plugin, which includes it: /plugin marketplace add ajyadav013/claude-kit, then /plugin install claude-kit@claude-kit.

### Does LLM gateway and routing run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use LLM gateway and routing?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to LLM gateway and routing?

The closest alternatives to LLM gateway and routing are Model adaptation, AI gateway, LLM agent, API AI augmented and Agentic eval.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Model adaptation](https://ai-powered.com/skills/model-adaptation): Model adaptation is an open-source agent skill for ai models and llm tooling.
- [AI gateway](https://ai-powered.com/skills/ai-gateway-scaledockhq): AI gateway is an open-source agent skill for ai models and llm tooling.
- [LLM agent](https://ai-powered.com/skills/llm-agent): LLM agent is an open-source agent skill for ai models and llm tooling.
- [API AI augmented](https://ai-powered.com/skills/api-ai-augmented): API AI augmented is an open-source agent skill for ai models and llm tooling.
- [Agentic eval](https://ai-powered.com/skills/agentic-eval): Agentic eval is an open-source agent skill for ai models and llm tooling.
- [Rag and model tuning](https://ai-powered.com/skills/rag-and-model-tuning-ajyadav013): Rag and model tuning is an open-source agent skill for knowledge and memory.
- [Apigee agent gateway governance](https://ai-powered.com/skills/apigee-agent-gateway-governance): Apigee agent gateway governance is an open-source agent skill for ai models and llm tooling.
- [Sh kb prompt injection](https://ai-powered.com/skills/sh-kb-prompt-injection): Sh kb prompt injection is an open-source agent skill for knowledge and memory.

---
Source: https://ai-powered.com/skills/llm-gateway-and-routing-ajyadav013
