mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-12-06 11:03:52 +00:00
Set users.anonymousGroup to a configured group to serve requests that carry no credential as the reserved user "anonymous" in that group. The group grant applies, and the group memberLimits are the per-user limits that all keyless callers share. A request that sends an Authorization or x-api-key header must carry a valid key, so a wrong or malformed credential still gets 401. The admin API and the metrics key fallback use identifyKeyed and never admit the anonymous user. The name "anonymous" is reserved while the option is set. The option is empty by default, and then every route needs a key as before. The .traefik.yml testData now enables anonymous access, and yaegi-check exercises it under the interpreter.
68 lines
2.3 KiB
YAML
68 lines
2.3 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, smart routers, MCP/A2A proxy.
|
|
testData:
|
|
providers:
|
|
openai:
|
|
type: openai
|
|
apiKey: test-key
|
|
promptCache:
|
|
key: true
|
|
models:
|
|
- gpt-test
|
|
- gpt-test-large
|
|
decider:
|
|
type: openai
|
|
apiKey: test-key
|
|
models:
|
|
- decider-test
|
|
pathBaseUrls:
|
|
/v1/decide: http://decider.example.invalid
|
|
groups:
|
|
default:
|
|
providers: []
|
|
# Keyless callers, see README.md#anonymous-access.
|
|
public:
|
|
models: [gpt-test]
|
|
memberLimits:
|
|
requestsPerMinute: 10
|
|
users:
|
|
anonymousGroup: public
|
|
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 and a shadow decision model, 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]
|
|
decision:
|
|
provider: decider
|
|
mode: shadow
|