llm-gateway-and-routing

llm-gateway-and-routing is a skill for Claude Code, Codex from jnPiyush/AgentX. It costs 87 tokens per session (1,381 once invoked), scanned A, original, Apache-2.0.

A guide to placing a shared gateway between applications and large language model providers. The gateway gives applications one interface while choosing providers, enforcing limits, and handling failures centrally.

In plain words
What is it for?
It helps route requests by cost, speed, capability, or access rules; add fallbacks and caching; enforce rate limits; manage keys; and attribute usage to teams or features.
Why use it?
Direct provider calls make model changes, outage recovery, access control, and cost tracking harder across multiple applications. A gateway centralizes those decisions and keeps provider keys out of application code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps route requests by cost, speed, capability, or access rules; add fallbacks and caching; enforce rate limits; manage keys; and attribute usage to teams or features.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jnpiyush/agentx/llm-gateway-and-routing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add jnPiyush/AgentX --skill llm-gateway-and-routing
Clone the repo
git clone --depth 1 https://github.com/jnPiyush/AgentX

Made for: Claude Code, Codex.

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 llm-gateway-and-routing

README.md
[![agentmods](https://agentmods.dev/badge/skills/jnpiyush/agentx/llm-gateway-and-routing/github.svg)](https://agentmods.dev/skills/jnpiyush/agentx/llm-gateway-and-routing)
Your own site
<a href="https://agentmods.dev/skills/jnpiyush/agentx/llm-gateway-and-routing"><img src="https://agentmods.dev/badge/skills/jnpiyush/agentx/llm-gateway-and-routing/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 llm-gateway-and-routing

Your own site · 80×15
<a href="https://agentmods.dev/skills/jnpiyush/agentx/llm-gateway-and-routing"><img src="https://agentmods.dev/badge/skills/jnpiyush/agentx/llm-gateway-and-routing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,381 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.00087 $0.01381
Opus 5.5 $0.00035 $0.00552
Sonnet 5.5 $0.00017 $0.00276
Haiku 4.5 $0.00009 $0.00138

Measured 1mo ago against content hash 1365f78bfb1c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

llm-gateway-and-routing 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 1mo 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.

.github/skills/ai-systems/llm-gateway-and-routing/SKILL.md · 158 lines

How it starts

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

LLM Gateway and Routing

Purpose: Stop calling LLM provider SDKs directly from app code. Put a gateway in front so you can swap models, cap cost, and survive provider outages.


When to Use This Skill

  • Multiple apps or teams calling LLMs in your org
  • Multiple providers in play (OpenAI + Anthropic + Azure + open-weights)
  • Need centralized cost, rate-limit, audit, and key management
  • Want semantic caching to cut spend
  • Need provider failover for SLO

What a Gateway Buys You

Capability Why
Unified API (OpenAI-compatible) One client SDK, many backends
Routing policy Cheapest / fastest / most capable per task
Failover Provider outage does not page on-call
Caching Exact + semantic; 20-60% cost cut typical
Rate limits & quotas Per team, per tenant, per key
Key vaulting App never sees provider keys
Cost attribution Tag spans by team/tenant/feature
PII / safety hooks Central guardrails
Audit log Compliance, incident response

Gateway Options

Gateway Notes
LiteLLM (OSS + cloud) 100+ providers, OpenAI-compatible, easy self-host
Portkey Hosted, strong observability + caching + guardrails
Azure AI Gateway / APIM with AI Gateway policies Native Azure, semantic caching, token rate limits
OpenRouter Hosted aggregator, many models, OAuth & marketplace
AWS Bedrock + Bedrock Gateway AWS-native, IAM integration
Kong AI Gateway Plugin-based on top of Kong
Self-built (FastAPI / Hono / ASP.NET) Full control, full ops cost

Recommendation: Start with LiteLLM or Portkey unless you must align with cloud provider (then Azure / Bedrock).


Routing Policies

Express as rules on a request:

input: { task_type, tenant, max_cost_usd, max_latency_ms, capability_required }
output: { primary: model_id, fallbacks: [model_id, ...] }

Common policies:

  • Capability: requires reasoning -> route to o-series / Claude extended thinking; else cheap model
  • Cost-tier: free / pro / enterprise tenants get different model tiers
  • Latency-SLO: chat UI route to fast models; batch jobs route to cheap models
  • Region / data residency: route per tenant geography
  • Open-weights fallback: if hosted provider 5xx, fall back to self-hosted Llama / Mistral

Read the full file on GitHub · 158 lines

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. 1mo ago Changed 1365f78bfb1c
  2. 1mo ago First seen · 158 lines · 87 tokens per session scan A aa818344564e

Subscribe to this mod's changes

llm-gateway-and-routing is a skill published in the GitHub repository jnPiyush/AgentX (16 stars, last pushed 3d ago), licensed Apache-2.0. It adds 87 tokens to every session and 1,381 once invoked, about $0.0003 per session on Opus 5.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-09-03.

Related

Other skills, from other repositories

gemini-api-agent-platform

Guides the usage of the Gemini API on Agent Platform with the Google Gen AI SDK for enterprise AI applications. Covers SDK usage (Python, JS/TS, Go, Java, C#), capabilities like Live API, tools, multimedia generation, caching, and batch prediction.

davila7/claude-code-templates · 61 tokens

open-source

Documentation reference for writing Python code using the browser-use open-source library. Use this skill whenever the user needs help with Agent, Browser, or Tools configuration, is writing code that imports from browseruse, asks about @sandbox deployment, supported LLM models, Actor API, custom tools, lifecycle…

browser-use/browser-use · 137 tokens

gemini-api-dev

Use this skill when writing code that calls the Gemini API for text generation, multi-turn chat, multimodal understanding, image generation, video generation, speech generation (TTS), voice design, voice replication, streaming responses, background research tasks, function calling, structured output, or migrating from…

google-gemini/gemini-skills · 85 tokens

deepstream-sop

Use this skill when building, deploying, evaluating, debugging, or measuring latency for the DeepStream SOP Inference Microservice — a GPU-accelerated FastAPI service that detects whether operators perform assembly-line steps in order via event boundary detection (GEBD) plus VLM classification. Trigger even if the…

NVIDIA/skills · 219 tokens

azure-search-documents-dotnet

Azure AI Search SDK for .NET (Azure.Search.Documents). Use for building search applications with full-text, vector, semantic, and hybrid search. Covers SearchClient (queries, document CRUD), SearchIndexClient (index management), and SearchIndexerClient (indexers, skillsets). Triggers: "Azure Search .NET"…

microsoft/skills · 102 tokens

varlock

Secure environment variable management with Varlock. Use when handling secrets, API keys, credentials, or any sensitive configuration. Ensures secrets are never exposed in terminal, logs, or LLM context. Provides guidance around integrating varlock into a project, reading/editing .env.schema and other .env files…

dmno-dev/varlock · 109 tokens