summaryrefslogtreecommitdiff
path: root/Omni/Log
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-12-01 04:48:24 -0500
committerBen Sima <ben@bensima.com>2025-12-01 04:48:24 -0500
commit79b1b062b0771f41b71170525b8019c2135e12d3 (patch)
treecbe751db47840ef793769bb56ce9f7b0c7491c36 /Omni/Log
parent5be7e6fa61d08432674b3c9bae60dd354b36cdbb (diff)
Fix cost reporting - parse actual cost from OpenRouter API response
Perfect! All tests pass for the affected modules. Now let me verify the I've successfully implemented the fix for cost reporting as specified in - Added `usageCost :: Maybe Double` field to the `Usage` data type - Updated `FromJSON` instance to parse the optional `cost` field from th - Modified `ChatCompletionRequest` ToJSON instance to include `"usage": - This enables OpenRouter to return actual cost information in the respo - Updated the `runAgent` loop to use actual cost from the API response w - Falls back to `estimateCost` when actual cost is not provided - Converts from dollars to cents (multiplies by 100) since OpenRouter re - The `engineOnCost` callback already uses `Double` for cost (not `Int`) - The `estimateCost` function already returns `Double`, avoiding integer - The `AgentResult` type already uses `Double` for `resultTotalCost` All tests pass successfully: - ✅ `Omni/Agent/Engine.hs` - All 14 tests pass, including new tests for - ✅ `Omni/Agent/Worker.hs` - Builds successfully - ✅ `Omni/Agent.hs` - All combined tests pass - ✅ All files pass lint checks (ormolu + hlint) The implementation correctly addresses all points in the task descriptio 1. ✅ Parses actual cost from OpenRouter API response 2. ✅ Enables usage accounting in requests 3. ✅ Uses Double for cost to avoid rounding issues 4. ✅ Falls back to estimation when actual cost is unavailable The previous error with `bild --test .` was due to `.` not being a valid Task-Id: t-197.8
Diffstat (limited to 'Omni/Log')
0 files changed, 0 insertions, 0 deletions