File tree Expand file tree Collapse file tree 1 file changed +9
-20
lines changed
Expand file tree Collapse file tree 1 file changed +9
-20
lines changed Original file line number Diff line number Diff line change @@ -137,24 +137,15 @@ const codexAgent: AgentDefinition<(typeof models)[number]> = {
137137 const turn = await thread . run ( prompt ) ;
138138 assert ( turn . usage , "The agent did not emit the usage information." ) ;
139139 usage = turn . usage ;
140- if ( ! pricing ) {
141- if ( ! missingPricing . has ( pricingKey ) ) {
142- missingPricing . add ( pricingKey ) ;
143- console . warn (
144- `[codex] Pricing not found for ${ pricingKey } ; using $0 for cost calculation.` ,
145- ) ;
146- }
147- } else {
148- const billableInput =
149- ( usage . input_tokens ?? 0 ) - ( usage . cached_input_tokens ?? 0 ) ;
150- const cachedInput = usage . cached_input_tokens ?? 0 ;
151- const output = usage . output_tokens ?? 0 ;
152- cost =
153- ( billableInput * pricing . input +
154- output * pricing . output +
155- cachedInput * pricing . cache_read ) /
156- 1_000_000 ;
157- }
140+ const billableInput =
141+ ( usage . input_tokens ?? 0 ) - ( usage . cached_input_tokens ?? 0 ) ;
142+ const cachedInput = usage . cached_input_tokens ?? 0 ;
143+ const output = usage . output_tokens ?? 0 ;
144+ cost =
145+ ( billableInput * pricing . input +
146+ output * pricing . output +
147+ cachedInput * pricing . cache_read ) /
148+ 1_000_000 ;
158149
159150 actions . push ( ...turn . items . map ( ( item ) => JSON . stringify ( item ) ) ) ;
160151 logTurnItems ( turn . items , options ) ;
@@ -192,5 +183,3 @@ const openai = (await response.json())["openai"] as {
192183 }
193184 } >
194185}
195-
196- const missingPricing = new Set < string > ( ) ;
You can’t perform that action at this time.
0 commit comments