mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
Add smart routers: virtual models that score each request and route it to admin-defined model tiers. A retryable failure moves the request to a higher tier. The classifier v2 extracts prose, finds the original ask in long tool loops, adds an uncertainty margin and reads tool-output failures. Sessions, outcome signals, bounded calibration, adaptive selection within a tier, gated saturation downgrade, a first-byte timeout and an opt-in timeout fallback are included. Every new feature is off by default. Add per-member group limits, a tokensPerMinute window that counts uncached input and output, rate-limit headers in three dialects, soft pacing before the hard limit, and a limitExemptKinds list so embedding and reranking traffic never counts toward or hits a limit. Fix yaegi named-result state that made smartContentSize grow between calls.
50 lines
1.8 KiB
YAML
50 lines
1.8 KiB
YAML
displayName: LLM Gateway
|
|
type: middleware
|
|
import: github.com/lukaszraczylo/traefik-llmgateway
|
|
# basePkg: Traefik's Yaegi middleware loader (pkg/plugins/middlewareyaegi.go,
|
|
# newYaegiMiddlewareBuilder) binds the interpreted package under
|
|
# strings.ReplaceAll(path.Base(import), "-", "_") — "traefik_llmgateway" —
|
|
# unless this field overrides it. The package itself declares
|
|
# `package traefikllmgateway` (no underscore), so without this override a
|
|
# real Traefik instance fails plugin load with
|
|
# `failed to eval New: ...: undefined: traefik_llmgateway`, discovered
|
|
# running the plugin in real Traefik v3.5 for the first time (Task 15's
|
|
# integration suite). Required for both Traefik itself and the Plugin
|
|
# Catalog analyzer (piceus), which uses this identical mechanism.
|
|
basePkg: traefikllmgateway
|
|
summary: Multi-provider LLM gateway with groups, per-user keys, token/cost limits, MCP/A2A proxy.
|
|
testData:
|
|
providers:
|
|
openai:
|
|
type: openai
|
|
apiKey: test-key
|
|
models:
|
|
- gpt-test
|
|
- gpt-test-large
|
|
groups:
|
|
default:
|
|
providers: []
|
|
users:
|
|
inline:
|
|
- name: tester
|
|
group: default
|
|
apiKey: test-user-key
|
|
# Prometheus text-exposition endpoint — see README.md#metrics. No
|
|
# allowedCIDRs here deliberately: this is the catalog-facing smoke-test
|
|
# config, and README.md#metrics has the full CIDR-sizing guidance
|
|
# (narrowest block only, never a whole RFC1918 range) that a
|
|
# copy-pasted example here would risk skipping past.
|
|
metrics:
|
|
enabled: true
|
|
# Two-tier smart router with the v2 classifier, see README.md#smart-routers.
|
|
smartRouters:
|
|
auto:
|
|
classifier: v2
|
|
tiers:
|
|
- name: small
|
|
minScore: 0
|
|
models: [openai/gpt-test]
|
|
- name: large
|
|
minScore: 400
|
|
models: [openai/gpt-test-large]
|