litellm/tests/unit
devin-ai-integration[bot] 8603d6e259
fix(cost): honor per-second custom pricing on chat completions for every provider (#42403)
* fix(cost): honor per-second custom pricing on chat completions for every provider

* test(cost): assert a per-second priced deployment bills instead of staying at $0

The zero-cost diagnostic tests from #42345 used a per-second-only entry as their
misconfigured fixture, which this branch now bills. Switch that fixture to a
per-query-only entry, which is still selected as the deployment's own pricing and
still prices chat usage at $0, and add a per-second test asserting the call
duration is billed with no diagnostic

Also let a caller's explicit total_time outrank the logging window in
completion_cost, so the SDK precedence stays stamped response, caller, logging

* test(response_metadata): move the per-second pricing regression into the mapped tests/unit file

* fix(cost_calculator): keep media-mode per-second rates off the wall-clock path

A video, transcription, speech, or realtime entry's per-second rates price media seconds, which
their dedicated cost paths bill from the media itself. The generic per-second branch now skips
those modes, so a video status poll on a per-second video model bills nothing instead of the
seconds the poll took to answer.

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-09-21 22:15:35 -07:00
..
a2a_protocol test(a2a): sort imports in merged bedrock agentcore test 2026-09-21 16:10:40 +00:00
anthropic_interface
batches
chat_completions feat(rust-bridge): add cache and secret migration foundations (#42328) 2026-09-22 03:41:04 +00:00
completion_extras test: add sync and async custom_llm_provider bridge propagation tests 2026-09-20 13:46:52 +00:00
compression
endpoints
enterprise
integrations
litellm_core_utils fix(cost): honor per-second custom pricing on chat completions for every provider (#42403) 2026-09-21 22:15:35 -07:00
llms fix(bedrock): sign batch S3 requests with s3_access_key_id and s3_secret_access_key (#42342) 2026-09-21 19:01:18 -07:00
messages feat(rust-bridge): add cache and secret migration foundations (#42328) 2026-09-22 03:41:04 +00:00
models feat(auth): breached password detection, self-service change-password and forced password reset 2026-09-21 18:48:35 +00:00
ocr feat(rust-bridge): add cache and secret migration foundations (#42328) 2026-09-22 03:41:04 +00:00
passthrough
rag
realtime_api
repositories
router_strategy fix(auto-router): skip JEV for encrypted delegated tasks 2026-09-21 18:29:21 +00:00
router_utils Merge pull request #42080 from BerriAI/litellm_prompt_caching_affinity_lookback 2026-09-21 12:44:34 -07:00
rust_bridge Merge remote-tracking branch 'origin/main' into litellm_migrate_tests_p15 2026-09-20 13:44:24 +00:00
sandbox
skills
test_router
types
videos
__init__.py
AGENTS.md
conftest.py test: use main's local_model_cost_map fixture in tests/unit/conftest.py 2026-09-20 13:44:30 +00:00
test_package_layout.py
test_socket_policy.py