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;
model: string;
pricing: {
input: number | null;
output: number | null;
cacheRead: number | null;
reasoningOutput: number | null;
in: number | null;
out: number | null;
cache: number | null;
reasoning: number | null;
};
};
type RawCatalogEntry = {
id?: string;
name?: string;
model?: string;
model: 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?: {
input?: number | null;
output?: number | null;
cacheRead?: number | null;
reasoningOutput?: number | null;
in?: number | null;
out?: number | null;
cache?: number | null;
reasoning?: number | null;
};
};
@@ -93,25 +87,18 @@ function normalizeEntry(raw: RawCatalogEntry): AiModelCatalogEntry | null {
return null;
}
const model = raw.model ?? raw.name ?? raw.id;
if (!model) {
if (!raw.model) {
return null;
}
return {
provider,
model,
model: raw.model,
pricing: {
input: raw.pricing?.input ?? raw.input_cost_per_token ?? null,
output: raw.pricing?.output ?? raw.output_cost_per_token ?? null,
cacheRead:
raw.pricing?.cacheRead ??
raw.cache_read_input_token_cost ??
null,
reasoningOutput:
raw.pricing?.reasoningOutput ??
raw.output_cost_per_reasoning_token ??
null
in: raw.pricing?.in ?? null,
out: raw.pricing?.out ?? null,
cache: raw.pricing?.cache ?? null,
reasoning: raw.pricing?.reasoning ?? null
}
};
}
+4 -4
View File
@@ -33,10 +33,10 @@ function toPricing(
approximate: boolean
): AiModelPricing {
return {
inputCostPerToken: entry.pricing.input,
outputCostPerToken: entry.pricing.output,
cacheReadInputTokenCost: entry.pricing.cacheRead,
outputCostPerReasoningToken: entry.pricing.reasoningOutput,
inputCostPerToken: entry.pricing.in,
outputCostPerToken: entry.pricing.out,
cacheReadInputTokenCost: entry.pricing.cache,
outputCostPerReasoningToken: entry.pricing.reasoning,
approximate
};
}