Adjust structure delete models

This commit is contained in:
Owen
2026-08-12 09:41:42 -04:00
parent 9369e60695
commit ac3402a8b3
3 changed files with 19 additions and 7591 deletions
-7559
View File
File diff suppressed because it is too large Load Diff
+15 -28
View File
@@ -47,27 +47,21 @@ export type AiModelCatalogEntry = {
provider: CatalogProvider; provider: CatalogProvider;
model: string; model: string;
pricing: { pricing: {
input: number | null; in: number | null;
output: number | null; out: number | null;
cacheRead: number | null; cache: number | null;
reasoningOutput: number | null; reasoning: number | null;
}; };
}; };
type RawCatalogEntry = { type RawCatalogEntry = {
id?: string; model: string;
name?: string;
model?: string;
provider: string; provider: string;
input_cost_per_token?: number | null;
output_cost_per_token?: number | null;
cache_read_input_token_cost?: number | null;
output_cost_per_reasoning_token?: number | null;
pricing?: { pricing?: {
input?: number | null; in?: number | null;
output?: number | null; out?: number | null;
cacheRead?: number | null; cache?: number | null;
reasoningOutput?: number | null; reasoning?: number | null;
}; };
}; };
@@ -93,25 +87,18 @@ function normalizeEntry(raw: RawCatalogEntry): AiModelCatalogEntry | null {
return null; return null;
} }
const model = raw.model ?? raw.name ?? raw.id; if (!raw.model) {
if (!model) {
return null; return null;
} }
return { return {
provider, provider,
model, model: raw.model,
pricing: { pricing: {
input: raw.pricing?.input ?? raw.input_cost_per_token ?? null, in: raw.pricing?.in ?? null,
output: raw.pricing?.output ?? raw.output_cost_per_token ?? null, out: raw.pricing?.out ?? null,
cacheRead: cache: raw.pricing?.cache ?? null,
raw.pricing?.cacheRead ?? reasoning: raw.pricing?.reasoning ?? null
raw.cache_read_input_token_cost ??
null,
reasoningOutput:
raw.pricing?.reasoningOutput ??
raw.output_cost_per_reasoning_token ??
null
} }
}; };
} }
+4 -4
View File
@@ -33,10 +33,10 @@ function toPricing(
approximate: boolean approximate: boolean
): AiModelPricing { ): AiModelPricing {
return { return {
inputCostPerToken: entry.pricing.input, inputCostPerToken: entry.pricing.in,
outputCostPerToken: entry.pricing.output, outputCostPerToken: entry.pricing.out,
cacheReadInputTokenCost: entry.pricing.cacheRead, cacheReadInputTokenCost: entry.pricing.cache,
outputCostPerReasoningToken: entry.pricing.reasoningOutput, outputCostPerReasoningToken: entry.pricing.reasoning,
approximate approximate
}; };
} }