The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
/**
* The credit price a model's catalogue entry declares (LU Cloud), for the
* cost brake. Null for every model without one: the brake then counts tokens
* only, as before.
*/
import { useModelStore } from '../../stores/modelStore'
import type { CreditRates } from '../../api/providers/types'
export function creditRatesOf(model: string | null | undefined): CreditRates | null {
if (!model) return null
const meta = useModelStore.getState().models.find((m) => m.name === model) as { creditRates?: CreditRates } | undefined
const r = meta?.creditRates
if (!r || typeof r.inputPerMillion !== 'number' || typeof r.outputPerMillion !== 'number') return null
return r
}
/** How LU Cloud billed one step ('flash' cost no credits), from any turn shape. */
export function billingOf(turn: unknown): 'flash' | 'credits' | undefined {
const b = turn && typeof turn === 'object' ? (turn as { billing?: unknown }).billing : undefined
return b === 'flash' || b === 'credits' ? b : undefined
}