• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

agentjido / req_llm / 4e239242e8e269db3b4d21994bf4be3fc97d1cfa
49%

Build:
DEFAULT BRANCH: main
Ran 24 Sep 2025 09:57PM UTC
Jobs 2
Files 56
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

24 Sep 2025 09:57PM UTC coverage: 58.576% (+0.7%) from 57.838%
4e239242e8e269db3b4d21994bf4be3fc97d1cfa

push

github

web-flow
Fix #31: Add cost calculation to Response.usage() (#35)

* Fix #31: Add cost calculation to Response.usage()

- Update Response.usage field to support cost fields (input_cost, output_cost, total_cost)
- Modify Step.Usage to handle Response structs and inject cost breakdown
- Add compute_cost_breakdown/2 to calculate separate cost components
- Add comprehensive tests for cost calculation with Response structs
- Preserve backward compatibility while extending functionality
- Update documentation examples to show cost fields

Resolves: Cost calculation doesn't work (#31)
Amp-Thread-ID: https://ampcode.com/threads/T-6227ac81-4999-46b0-9509-9747c1f0590a
Co-authored-by: Amp <amp@ampcode.com>

* Formatting

* Add OpenAI cached tokens support to cost calculations

- Extend Model cost type to support optional cached_input rate
- Update usage normalization to extract cached_tokens from prompt_tokens_details
- Modify cost calculation to handle cached vs uncached input tokens separately
- Add cached_tokens field to Response.usage when present
- Implement proper edge case handling (clamping, type conversion)
- Add comprehensive tests for cached token scenarios
- Maintain full backward compatibility with existing cost maps

OpenAI cached tokens now receive proper 50% discount pricing when
cached_input rate is specified in model cost configuration.

Related to #31 - ensures accurate cost calculation for OpenAI responses

Amp-Thread-ID: https://ampcode.com/threads/T-6227ac81-4999-46b0-9509-9747c1f0590a
Co-authored-by: Amp <amp@ampcode.com>

* Formatting

* Refactor compute_cost_breakdown specification and simplify token handling

- Updated the type specification for compute_cost_breakdown/2 to use map() instead of a specific map structure for improved flexibility.
- Simplified the logic for extracting cached tokens by directly using Map.get/3, enhancing code clarity and maintainability.

These changes streamline the cost calculation process within the ReqLLM.Step.Usa... (continued)

61 of 61 new or added lines in 3 files covered. (100.0%)

1711 of 2921 relevant lines covered (58.58%)

316.71 hits per line

Jobs
ID Job ID Ran Files Coverage
1 4e239242e8e269db3b4d21994bf4be3fc97d1cfa.1 24 Sep 2025 09:57PM UTC 56
58.58
GitHub Action Run
2 4e239242e8e269db3b4d21994bf4be3fc97d1cfa.2 24 Sep 2025 09:57PM UTC 56
58.48
GitHub Action Run
Source Files on build 4e239242e8e269db3b4d21994bf4be3fc97d1cfa
  • Tree
  • List 56
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 4e239242 on github
  • Prev Build on main (#00D5A5BB...)
  • Next Build on main (#046E2904...)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc