@@ -41,6 +41,7 @@ import type { AssistantMessage, FilePart, UserMessage } from "@opencode-ai/sdk/v
4141import { Locale } from "../../util/locale"
4242import { errorMessage } from "../../util/error"
4343import { formatDuration } from "../../util/format"
44+ import { contextLimit , formatSessionCost } from "../../util/accounting"
4445import { createColors , createFrames } from "../../ui/spinner"
4546import { useDialog } from "../../ui/dialog"
4647import { DialogProvider as DialogProviderConnect } from "../dialog-provider"
@@ -96,11 +97,6 @@ export type PromptRef = {
9697 submit ( ) : void
9798}
9899
99- const money = new Intl . NumberFormat ( "en-US" , {
100- style : "currency" ,
101- currency : "USD" ,
102- } )
103-
104100const DRAFT_RETENTION_MIN_CHARS = 20
105101
106102function randomIndex ( count : number ) {
@@ -273,11 +269,12 @@ export function Prompt(props: PromptProps) {
273269 if ( tokens <= 0 ) return
274270
275271 const model = sync . data . provider . find ( ( item ) => item . id === last . providerID ) ?. models [ last . modelID ]
276- const pct = model ?. limit . context ? `${ Math . round ( ( tokens / model . limit . context ) * 100 ) } %` : undefined
272+ const limit = contextLimit ( model , last . variant )
273+ const pct = limit ? `${ Math . round ( ( tokens / limit ) * 100 ) } %` : undefined
277274 const cost = session ?. cost ?? 0
278275 return {
279276 context : pct ? `${ Locale . number ( tokens ) } (${ pct } )` : Locale . number ( tokens ) ,
280- cost : cost > 0 ? money . format ( cost ) : undefined ,
277+ cost : cost > 0 ? formatSessionCost ( cost , msg ) : undefined ,
281278 }
282279 } )
283280
0 commit comments