litellm/enterprise/litellm_enterprise/proxy/common_utils
mateo-berri 787a108664 fix(batches): keep the endpoint a batch was created for on retrieve, cancel and cost polling
Backport of #50784 to lts/1.108.x as one adapted commit

A Bedrock batch created for /v1/embeddings or /v1/responses came back from
GET /v1/batches/{id} and cancel as /v1/chat/completions, and the cost poller
billed it the same way. The endpoint saved at create now wins over a provider
answer of chat or empty, and Bedrock retrieve reads /v1/embeddings from the
job's model through the cost map. Cohere Embed v3 gains output_vector_size so
it is read as an embedding model too

Adapted from these main commits (net diff applied, conflicts resolved for the
line's paths, check_batch_cost.py still lives under enterprise/ here):
de995b48e8
2184695446
a6b9f4d894
7f51cb1ce7
d54a31f1a8
2617ad780e
c11902afe1
06b4a21e69 (empty ci commit, nothing to apply)
2026-11-14 06:20:02 -08:00
..
__init__.py Normalize OpenAI SDK BaseModel choices/messages to avoid Pydantic serializer warnings (#18972) 2026-01-14 03:40:11 +05:30
check_batch_cost.py fix(batches): keep the endpoint a batch was created for on retrieve, cancel and cost polling 2026-11-14 06:20:02 -08:00
check_responses_cost.py fix(responses): bill a background response once, on the first read or poll that sees it finished (#45703) 2026-10-15 11:00:14 -07:00
managed_object_attribution.py fix(batch): preserve recoverable costs and prevent poll starvation (#47190) 2026-10-27 19:57:38 -07:00