Use Canonical Models to set context window sizes (#6723)

This commit is contained in:
David Katz
2026-02-17 11:43:10 -05:00
committed by GitHub
parent 576590d4c8
commit 3959805198
54 changed files with 465 additions and 581 deletions
+24
View File
@@ -0,0 +1,24 @@
/**
* Utilities for fetching canonical model information from the backend
*/
import { getCanonicalModelInfo, type ModelInfoData } from '../api';
/**
* Fetch canonical model info (pricing + context limits) for a specific provider/model
*/
export async function fetchCanonicalModelInfo(
provider: string,
model: string
): Promise<ModelInfoData | null> {
try {
const response = await getCanonicalModelInfo({
body: { provider, model },
throwOnError: true,
});
return response.data.model_info ?? null;
} catch {
return null;
}
}
-24
View File
@@ -1,24 +0,0 @@
import { getPricing, PricingData } from '../api';
/**
* Fetch pricing for a specific provider/model from the backend
*/
export async function fetchModelPricing(
provider: string,
model: string
): Promise<PricingData | null> {
try {
const response = await getPricing({
body: { provider, model },
throwOnError: false,
});
if (!response.data) {
return null;
}
return response.data.pricing?.[0] ?? null;
} catch {
return null;
}
}