Skip to content
Merged
Show file tree
Hide file tree
Changes from 81 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
b38b867
feat(batches): emit per-line JSONL batch records to callbacks
shivamrawat1 Sep 17, 2026
0ea8ce7
fix(batches): only emit line items for final batches
shivamrawat1 Sep 17, 2026
7fa8c92
chore(deps): bump soupsieve to 2.9.2 for GHSA-gjv8-xp57-g29c and GHSA…
shivamrawat1 Sep 17, 2026
c7edcce
style(batches): satisfy ruff format for line item logging
shivamrawat1 Sep 17, 2026
7f06708
chore(ui): regenerate schema.d.ts for store_batch_line_items_in_callb…
shivamrawat1 Sep 17, 2026
8908023
test(batches): cover line-item edge shapes and general settings propa…
shivamrawat1 Sep 17, 2026
8aca0c3
fix(batches): keep deployment credentials out of callback-visible params
shivamrawat1 Sep 17, 2026
ff9d30b
refactor(batches): declare credential transport attribute on Logging
shivamrawat1 Sep 17, 2026
feea6f2
chore: merge origin/main into litellm_batch_jsonl_line_item_callbacks
shivamrawat1 Sep 18, 2026
775d851
chore: merge origin/main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Sep 23, 2026
8484b2f
test(batches): integration contract for per-line batch callback events
yucheng-berri Sep 23, 2026
b4cb884
fix(proxy): resolve store_batch_line_items_in_callbacks through the s…
yucheng-berri Sep 23, 2026
61d5ab0
test(batches): assert per-line events beside the aggregate and create…
yucheng-berri Sep 23, 2026
bc53e23
fix(proxy): drop resurrected use_legacy_interactions_schema shim from…
yucheng-berri Sep 23, 2026
4b6efef
test(batches): assert line item events carry no credentials
yucheng-berri Sep 23, 2026
ed23e2e
fix(proxy): reset batch line-item flag when the setting is absent
yucheng-berri Sep 23, 2026
096ba84
fix(batches): map anthropic batch lines through the anthropic message…
yucheng-berri Sep 23, 2026
a8fafaf
style: tag the anthropic result cast with a cast-ok reason
yucheng-berri Sep 23, 2026
c746e57
style: shorten cast-ok reason so ruff format passes
yucheng-berri Sep 23, 2026
45b7509
fix(batches): skip line-item callbacks for providers without a line r…
yucheng-berri Sep 23, 2026
bef2f04
fix(batches): reconstruct bedrock and mistral batch lines through the…
yucheng-berri Sep 23, 2026
6cbad5c
style: wrap widened provider literals so ruff format passes
yucheng-berri Sep 23, 2026
a760991
fix(batches): pair bedrock lines by recordId and type them from the r…
yucheng-berri Sep 23, 2026
271b6c6
chore: merge main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Sep 23, 2026
c0b69ae
fix(batches): keep line item events out of proxy limiters and strip c…
yucheng-berri Sep 23, 2026
67d4471
fix(batches): keep cast-ok tags on the flagged cast lines for the dis…
yucheng-berri Sep 23, 2026
ee8dcfc
fix(batches): skip failed line item events in parallel request limite…
yucheng-berri Sep 23, 2026
a2fd2a8
test(batches): tolerate lifecycle spend rows when asserting no line i…
yucheng-berri Sep 23, 2026
fe11251
chore: merge main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Sep 24, 2026
05d6977
fix(batches): place mutable-ok tags on the lines the discipline gate …
yucheng-berri Sep 24, 2026
f5670e0
fix(batches): skip router budget accounting for batch line item events
yucheng-berri Sep 24, 2026
0ca85b4
chore: merge main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Sep 24, 2026
dd9d4fd
chore: merge main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Sep 24, 2026
4c86f0b
fix(batches): keep anthropic line errors and skip native vertex batch…
yucheng-berri Sep 25, 2026
5777f7e
test(batches): restore test-quality tags on line item tests
yucheng-berri Sep 25, 2026
87d82b9
chore: merge main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Sep 25, 2026
f4a6e12
Merge remote-tracking branch 'origin/main' into litellm_batch_jsonl_l…
yucheng-berri Sep 26, 2026
f3ba65d
test: move batch line-item unit test to tests/unit after merging main
yucheng-berri Sep 26, 2026
f65b5b1
fix(batches): emit batch line-item callbacks once per batch
yucheng-berri Sep 27, 2026
cffa640
fix(batches): release line-item claim when fan-out emitted nothing
yucheng-berri Sep 27, 2026
a7c9ded
fix(batches): make the line-item claim release ownership-safe
yucheng-berri Sep 29, 2026
f69d5c5
fix(batches): keep bodyless failed batch lines reaching callbacks
yucheng-berri Sep 30, 2026
5f35c25
fix(logging): seed batch line hidden params in get_hidden_params defa…
yucheng-berri Sep 30, 2026
a891065
merge: main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Sep 30, 2026
ff77170
perf(batches): reuse fetched batch result files for line-item logging
yucheng-berri Sep 30, 2026
1388dbc
fix(batches): release line-item claim when nothing was emitted
yucheng-berri Sep 30, 2026
ee21adb
Merge remote-tracking branch 'origin/main' into litellm_batch_jsonl_l…
yucheng-berri Oct 1, 2026
4d96efc
Merge remote-tracking branch 'origin/main' into litellm_batch_jsonl_l…
yucheng-berri Oct 1, 2026
64c514c
fix(batches): type batch line-item callback sites to satisfy basedpyr…
yucheng-berri Oct 1, 2026
aebde2a
style: wrap batch hidden-params cast for ruff format
yucheng-berri Oct 1, 2026
06fb342
Merge remote-tracking branch 'origin/main' into litellm_batch_jsonl_l…
yucheng-berri Oct 1, 2026
eac1ed0
fix(batches): reason suppressions for batch line-item lint deltas
yucheng-berri Oct 1, 2026
e1b9449
Merge remote-tracking branch 'origin/main' into litellm_batch_jsonl_l…
yucheng-berri Oct 1, 2026
60a47e2
chore: drop stale mutable-ok suppressions after LIT002 removal
yucheng-berri Oct 1, 2026
a7f1978
fix(batches): skip batch line-item events in ClickHouse spend sink an…
yucheng-berri Oct 4, 2026
9ca41c9
Merge origin/main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Oct 4, 2026
9c71dae
fix(clickhouse): skip failed batch line items in the spend sink too
yucheng-berri Oct 5, 2026
8ec50a2
fix(batches): declare batch_line_items service family on claim calls
yucheng-berri Oct 5, 2026
a35d4ee
fix(integrations): keep batch line items out of the built-in metering…
yucheng-berri Oct 5, 2026
c9f67ff
style: format metering-sinks test
yucheng-berri Oct 5, 2026
1b02cb6
fix(otel): skip synthetic line-item durations in v2 metrics; isolate …
yucheng-berri Oct 5, 2026
6348a7d
Merge remote-tracking branch 'origin/main' into litellm_batch_jsonl_l…
yucheng-berri Oct 6, 2026
b139924
chore: merge main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Oct 6, 2026
db33862
chore: merge main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Oct 6, 2026
15fa86c
chore: merge main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Oct 7, 2026
1b63787
chore: finish main merge conflict resolution for batch line items
yucheng-berri Oct 7, 2026
235019d
style: sort imports in litellm_logging after main merge
yucheng-berri Oct 7, 2026
6b8fb29
chore: merge origin/main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Oct 7, 2026
0632fdd
Merge remote-tracking branch 'origin/main' into fix41691
yucheng-berri Oct 8, 2026
b57e4f0
test(batches): use the public hook class names main now exports
yucheng-berri Oct 8, 2026
c653e2e
fix(batches): only the batch writer can mark a callback event as a li…
yucheng-berri Oct 8, 2026
e00471b
chore(batches): keep the lint gates within main's ceilings after the …
yucheng-berri Oct 8, 2026
317764c
fix(anthropic): read the message id off the validated message
yucheng-berri Oct 8, 2026
85fc449
fix(batches): an unreadable error file no longer drops the output lin…
yucheng-berri Oct 8, 2026
21cd892
test(batches): pin billing for batch_parent_id on every endpoint and …
yucheng-berri Oct 8, 2026
7cf3024
test(batches): bill every request of a concurrent burst mixing forged…
yucheng-berri Oct 8, 2026
4bd5762
revert: keep the line-item fan-out all-or-nothing on an unreadable er…
yucheng-berri Oct 8, 2026
4cc9f56
test(batches): pin the all-or-nothing retry and warm the burst model …
yucheng-berri Oct 8, 2026
586b022
Merge remote-tracking branch 'origin/main' into fix41691
yucheng-berri Oct 8, 2026
f26f86b
Merge remote-tracking branch 'origin/main' into fix41691
yucheng-berri Oct 9, 2026
07d543c
fix(batches): run the line fan-out outside the aggregate event's dead…
yucheng-berri Oct 9, 2026
6e826b4
fix(batches): let running line fan-outs finish before proxy shutdown …
yucheng-berri Oct 10, 2026
fd7a099
Merge remote-tracking branch 'origin/main' into fix41691
yucheng-berri Oct 12, 2026
9ed3211
fix(batches): keep batch line fields off callback kwargs and skip fan…
yucheng-berri Oct 12, 2026
8a46101
fix(batches): log batch lines under the retrieve's callback settings …
yucheng-berri Oct 12, 2026
7ae8fec
test(batches): line events follow the key's message logging opt-out
yucheng-berri Oct 12, 2026
903c593
test(batches): line events follow team logging settings, keep the lin…
yucheng-berri Oct 12, 2026
2b30a09
fix(batches): keep in-memory line claims for 10,000 batches and pin m…
yucheng-berri Oct 12, 2026
0865123
Keep batch line unit tests in-process and drop repeated per-sink comm…
yucheng-berri Oct 12, 2026
56b60e6
Share one batch provider alias across batch_utils and line item logging
yucheng-berri Oct 12, 2026
0470177
Report Bedrock line status codes, skip unknown Bedrock lines without …
yucheng-berri Oct 12, 2026
8f2c935
Read a swallowed Redis claim failure as unavailable, price unpriceabl…
yucheng-berri Oct 12, 2026
d62c5f2
Call handle_completed_batch when line items are off, keep a cache tes…
yucheng-berri Oct 12, 2026
f6dc422
Hand the cost poller's credential snapshot to line item file reads, s…
yucheng-berri Oct 12, 2026
6125f5f
Log batch lines through the sync callbacks a direct async call runs, …
yucheng-berri Oct 12, 2026
cbdbbb5
fix(batches): log failed Bedrock embedding lines as embeddings with t…
yucheng-berri Oct 13, 2026
5460242
fix(batches): keep a Bedrock line's system prompt in its logged messages
yucheng-berri Oct 13, 2026
f010f96
Merge remote-tracking branch 'origin/main' into fix41691
yucheng-berri Oct 13, 2026
4c120da
feat(batches): store per-line batch requests and responses in S3/GCS …
yucheng-berri Oct 13, 2026
7ab9a3f
fix(batches): store batch line items after the batch is billed and re…
yucheng-berri Oct 13, 2026
5cad620
test(batches): cover team-level and deleted-key redaction of batch li…
yucheng-berri Oct 13, 2026
aa76a2e
fix(batches): store batch line items in the background so a hung buck…
yucheng-berri Oct 13, 2026
15f3d73
fix(batches): store an unbilled batch's line items only once it is re…
yucheng-berri Oct 13, 2026
21a7109
fix(batches): price and write batch line items off the event loop
yucheng-berri Oct 13, 2026
082a859
fix(batches): pair no request for a shared custom_id and wait for an …
yucheng-berri Oct 13, 2026
459234f
fix(batches): store batch line items only once the poll has billed ev…
yucheng-berri Oct 13, 2026
400a6f9
fix(batches): hash line-item objects off the event loop and keep line…
yucheng-berri Oct 13, 2026
ee61a60
fix(batches): keep request and response for batches created without a…
yucheng-berri Oct 13, 2026
85169fc
fix(batches): pair line items with the right request on every deploym…
yucheng-berri Oct 13, 2026
2875f03
fix(batches): let OAuth2 batches follow team and proxy message loggin…
yucheng-berri Oct 13, 2026
4ba1eaa
Merge branch 'main' into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Oct 14, 2026
0ee34c9
fix(batches): hash the creator credential and write batch line items …
yucheng-berri Oct 14, 2026
a02fc23
chore: merge main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Oct 14, 2026
bc925d4
docs(batches): say async_log_batch_line_items is called once per part
yucheng-berri Oct 15, 2026
315d705
fix(batches): log an error when a batch's deployment is gone before i…
yucheng-berri Oct 15, 2026
c75d257
Merge origin/main into litellm_batch_jsonl_line_item_callbacks
yucheng-berri Oct 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,10 @@ async def _track_completed_batch_cost(

"""
from litellm.batches.batch_utils import (
count_error_file_failed_requests,
get_file_content_as_dictionary,
calculate_batch_cost_and_usage,
count_error_file_failed_requests_from_content,
fetch_batch_error_file_content,
)
from litellm.files.main import afile_content
from litellm.files.types import FileContentCallOptions
Expand Down Expand Up @@ -874,14 +875,15 @@ async def _track_completed_batch_cost(
model_name=model_name,
model_info=deployment_model_info,
)
error_file_failed_requests: Final = await count_error_file_failed_requests(
error_file_content = await fetch_batch_error_file_content(
response,
custom_llm_provider=batch_file_provider,
litellm_params={
**credentials,
"_litellm_internal_model_credentials": MappingProxyType(dict(credentials)),
},
)
error_file_failed_requests: Final = count_error_file_failed_requests_from_content(error_file_content)
batch_result: Final = (
output_file_result
if not error_file_failed_requests
Expand Down Expand Up @@ -921,6 +923,7 @@ async def _track_completed_batch_cost(
optional_params={},
custom_llm_provider=str(llm_provider) if llm_provider else None,
)
logging_obj._litellm_internal_model_credentials = MappingProxyType(dict(credentials)) # pyright: ignore[reportPrivateUsage] # trusted credentials transport, consumed by batch_line_item_logging

if not await self._claim_job_for_costing(job):
verbose_proxy_logger.info(
Expand All @@ -939,6 +942,8 @@ async def _track_completed_batch_cost(
batch_failed_requests=batch_result.failed_requests,
batch_prompt_cost=batch_result.prompt_cost,
batch_completion_cost=batch_result.completion_cost,
batch_output_file_content=content_bytes,
Comment thread
veria-ai[bot] marked this conversation as resolved.
Resolved
batch_error_file_content=error_file_content,
)
except Exception:
await self._release_job_claim(job)
Expand Down
1 change: 1 addition & 0 deletions litellm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ def _dev_env_hot_reload_enabled() -> bool:
)
openai_system_messages_first: bool = False
disable_vertex_batch_output_transformation: bool = False
store_batch_line_items_in_callbacks: bool = False
extra_spend_tag_headers: Optional[List[str]] = None
in_memory_llm_clients_cache: "LLMClientCache"
safe_memory_mode: bool = False
Expand Down
Loading
Loading