fix: add cost calculation to VolcEngine transform_get_response_api_response

Greptile P1 issue: VolcEngineResponsesAPIConfig.transform_get_response_api_response
was missing cost calculation, causing all GET-response calls to report $0 cost.

Added _calculate_response_cost call with model extraction from response JSON
or logging_obj, matching the pattern used in Manus provider.

Fixes lines 362-380 issue raised in PR review.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Chris Hunter 2026-04-27 16:40:24 +02:00
parent 9733797655
commit 3b5f467192

View file

@ -377,6 +377,13 @@ class VolcEngineResponsesAPIConfig(OpenAIResponsesAPIConfig):
response = ResponsesAPIResponse(**raw_response_json)
response._hidden_params["additional_headers"] = processed_headers
response._hidden_params["headers"] = raw_response_headers
# Calculate costs from usage data (fixes P1 issue - VolcEngine GET-response)
usage_dict = raw_response_json.get("usage", {})
model = raw_response_json.get("model") or getattr(logging_obj, "model", None)
if model:
self._calculate_response_cost(model, usage_dict, response)
return response
#########################################################