agentleFS
XData-siXData-si/xdata-agenthub/skills/llm-gateway-routing/SKILL.md

llm-gateway-routing

Skill1 starsChanged 34 days agoMITView on GitHub

Design an LLM gateway layer — one OpenAI-compatible endpoint with per-team keys, model aliases, routing and fallbacks, budgets, rate limits, caching and logging policy (for example LiteLLM, Portkey, Envoy AI Gateway or a cloud gateway). Use when several applications or agents consume models from multiple providers, or when costs and keys are getting out of control.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No application holds a provider key directly (repository and configuration search).

    line 40

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LLM Gateway and Routing

Goal

Applications call stable model aliases through one controlled entry point, while the platform team manages providers, keys, spend, reliability and data policy centrally.

Inputs

  • Consumers (applications, agents, teams), their models, volumes and data sensitivity.
  • Providers and self-hosted endpoints, contracts and data-processing terms, budget owners.

Procedure

  1. Model aliases. Applications use names such as chat-default, chat-reasoning, embed-default; the gateway maps aliases to concrete provider models and versions. Changing the provider does not require application releases.
  2. Keys per consumer. Virtual keys per application or agent with allowed aliases, rate limits (requests and tokens per minute) and budgets; provider keys stay only in the gateway's secret store.
  3. Routing and fallback. Define a primary and fallback per alias (another region, provider or local model); fall back on timeouts, 429 and 5xx only — not on 4xx validation errors; cap retries; make sure fallbacks satisfy the same data-policy class.
  4. Data policy classes. For example public, internal, confidential: confidential traffic routes only to approved providers or self-hosted models; enforce by key or metadata rather than by convention.
  5. Budgets and alerts. Per key and per team, with soft alerts (80 %) and hard limits; daily cost reports by alias and consumer.
  6. Caching. Exact or semantic caching only where answers are not user-specific; scope the cache by tenant; set TTLs.
  7. Logging. Metadata by default (consumer, alias, model, tokens, latency, cost, status); prompt and response logging only where approved, with retention limits and redaction.
  8. Reliability. Health checks per backend, timeouts per alias, and dashboards for error rate, latency and fallback rate.
  9. Change management. Alias remapping goes through review with an evaluation run (see llm-output-evaluation), and is announced to consumers.

Example fixture

aliases:
  chat-default:
    primary: provider-a/model-x-2024-08
    fallback: [self-hosted/model-y-awq]
    data_class: internal
keys:
  support-bot: {aliases: [chat-default], tpm: 200000, monthly_budget_eur: 300}

Negative test: the support-bot key requesting chat-reasoning is refused; a confidential-class key never routes to a non-approved provider even during a fallback.

Acceptance checks

  • No application holds a provider key directly (repository and configuration search).
  • Each key has scoped aliases, rate limits and a budget; exceeding them is tested.
  • Fallback behaviour is tested by simulating a primary outage, and respects data classes.
  • Logging policy and retention are documented and match the configuration.

Output

Gateway configuration, alias and key matrix, data-policy mapping, dashboards and test results.

Safety

The gateway concentrates sensitive traffic: protect its admin interface and API (never public without authentication), rotate provider keys, and restrict who can read logs. Prompts and responses often contain personal data: before routing or logging them through a provider, confirm a data processing agreement, the processing location (EU or a valid GDPR transfer mechanism) and retention; route personal and confidential data classes only to approved EU or self-hosted endpoints, and for AI systems offered in the EU check AI Act duties (see eu-ai-act-readiness, eu-data-sovereignty).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.