MCPcopy Create free account
hub / github.com/TanStack/ai / convertPrice

Function convertPrice

scripts/sync-provider-models.ts:205–210  ·  view source on GitHub ↗

* Convert an OpenRouter price string to per-million-token pricing. * Same logic as the existing convert script.

(priceStr: string | undefined)

Source from the content-addressed store, hash-verified

203 * Same logic as the existing convert script.
204 */
205function convertPrice(priceStr: string | undefined): number {
206 const price = parseFloat(priceStr ?? '0')
207 if (isNaN(price)) return 0
208 const result = price * 1_000_000
209 return Math.round(result * 1e10) / 1e10
210}
211
212/**
213 * Normalize a model ID for comparison.

Callers 1

generateModelConstantFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected