feat(proxy): auto-discovery de modelos + backend Kimchi

- Nueva interfaz Discoverer con Refresh() por backend
- Kilo: full auto (isFree + metadata completa del upstream)
- OpenCode: heurística -free para descubrir nuevos free
- Kimchi: agrega todos los IDs no-curados del upstream
- discoveryLoop cada 10 min en el Proxy
- Backends stateful (mutex + catálogo dinámico)
- CREDENCIALES.md y KIMCHI_ANALISIS.md documentan el setup
This commit is contained in:
renato97
2026-07-12 19:58:30 -03:00
parent 05a52d29e2
commit 46127431a3
8 changed files with 1041 additions and 29 deletions
+15
View File
@@ -11,6 +11,8 @@ type Backend interface {
Name() string
// Models returns the free models this backend exposes, for /v1/models listing.
// Implementations may return a dynamic (discovered) catalogue; before the
// first successful Refresh() they fall back to the curated list.
Models() []ModelInfo
// Resolve maps a client-requested model name to the upstream model ID.
@@ -25,3 +27,16 @@ type Backend interface {
// request to the upstream (auth, client-id, request/session tracking, etc.).
Headers(requestID, sessionID string) map[string]string
}
// Discoverer is an optional capability a Backend may implement to
// auto-discover its model catalogue from the upstream /models endpoint.
//
// The Proxy runs a discovery loop that calls Refresh() periodically. Each
// implementation owns its parsing and free-model filtering logic, and merges
// discovered models with its curated base layer (curated metadata always wins
// for known IDs).
type Discoverer interface {
// Refresh fetches the upstream model list and updates the backend's
// dynamic catalogue. Safe to call concurrently with Models()/Resolve().
Refresh() error
}