Files
localmodelroutex/backend/migrations/000006_fallback_model.up.sql
LovroG05 8bb62a1c20
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat: serve a backup model when the requested model fails
Any model can name another model as its backup. The gateway tries the
backup when the model is offline, rate limited, or its upstream fails
before the client has received anything. The response reports the
requested model, so the client sees no switch. The request log records
each failed attempt and the address that served the request, and the
cost uses the backup's prices.
2026-10-15 09:56:01 +02:00

10 lines
553 B
SQL

-- Admin-configured backup model. When the model is unavailable or its upstream
-- fails, the gateway serves the request with the backup instead. NULL means
-- there is no backup. Deleting the backup clears the reference.
ALTER TABLE provider_models
ADD COLUMN fallback_model_id uuid REFERENCES provider_models (id) ON DELETE SET NULL;
-- The address that served a request when it differs from model_name, which is
-- the address the client requested. NULL when the requested model served it.
ALTER TABLE request_logs ADD COLUMN served_model text;