Skip to content

Commit 74f2770

Browse files
committed
update
1 parent d613b12 commit 74f2770

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

agents/codex.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff 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>();

0 commit comments

Comments
 (0)