mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
fix: move _set_usage_and_cost outside try/except in OpenRouter image edit
Prevents discarding already-parsed images when usage calculation fails.
This commit is contained in:
parent
6f74d3881a
commit
4b1389501d
1 changed files with 3 additions and 3 deletions
|
|
@ -242,9 +242,6 @@ class OpenRouterImageEditConfig(BaseImageEditConfig):
|
|||
)
|
||||
)
|
||||
|
||||
self._set_usage_and_cost(model_response, response_json, model)
|
||||
return model_response
|
||||
|
||||
except Exception as e:
|
||||
raise OpenRouterException(
|
||||
message=f"Error transforming OpenRouter image edit response: {str(e)}",
|
||||
|
|
@ -252,6 +249,9 @@ class OpenRouterImageEditConfig(BaseImageEditConfig):
|
|||
headers={},
|
||||
)
|
||||
|
||||
self._set_usage_and_cost(model_response, response_json, model)
|
||||
return model_response
|
||||
|
||||
def get_error_class(
|
||||
self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers]
|
||||
) -> BaseLLMException:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue