feat(database,webapp): add LlmModel pricing_unit column and admin selector (#3820)
## Summary
Adds a nullable `pricing_unit` column to the LLM model registry's
`llm_models` table, recording how each model is billed ("tokens",
"characters", "images", "minutes", "requests", "free", "not_findable").
It lets pricing-coverage reporting exclude models that aren't priced
per-token (image/video/audio models currently drag the "% priced" number
down even though they can never carry a per-token price), and lays the
groundwork for non-token pricing.
The default model catalog is entirely per-token, so `seed` and
`syncLlmCatalog` set `pricing_unit="tokens"` on those rows. The admin
LLM model form (create + edit) and the admin API get a pricing-unit
selector so admin-curated models can set it; existing rows can stay
unset.
Auto-discovered models get their unit from the model-registry pipeline,
which lands separately.
---------
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "public"."llm_models" ADD COLUMN "pricing_unit" TEXT;
|
||||
@@ -2909,6 +2909,8 @@ model LlmModel {
|
||||
capabilities String[] @default([]) @map("capabilities")
|
||||
isHidden Boolean @default(false) @map("is_hidden")
|
||||
baseModelName String? @map("base_model_name")
|
||||
// "tokens", "images", "characters", "minutes", "requests", "free", "not_findable"; null until researched
|
||||
pricingUnit String? @map("pricing_unit")
|
||||
|
||||
pricingTiers LlmPricingTier[]
|
||||
prices LlmPrice[]
|
||||
|
||||
@@ -46,6 +46,7 @@ export async function seedLlmPricing(prisma: PrismaClient): Promise<{
|
||||
capabilities: catalog?.capabilities ?? [],
|
||||
isHidden: catalog?.isHidden ?? false,
|
||||
baseModelName: catalog?.baseModelName ?? null,
|
||||
pricingUnit: "tokens",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ export async function syncLlmCatalog(prisma: PrismaClient): Promise<{
|
||||
catalog?.baseModelName === undefined
|
||||
? existing.baseModelName
|
||||
: catalog.baseModelName,
|
||||
pricingUnit: existing.pricingUnit ?? "tokens",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user