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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user