Files
tkmind_go/ui/desktop/src/utils/pricing.ts
T
2025-12-18 11:44:36 -05:00

25 lines
484 B
TypeScript

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;
}
}