code: def update_cost(
      self,
      user: str,
      completion_obj: Optional[ModelResponse] = None,
      model: Optional[str] = None,
      input_text: Optional[str] = None,
      output_text: Optional[str] = None,
  ):
      if model and input_text and output_text:
          prompt_tokens = litellm.token_counter(
              model=model,
              messages=[{"role": "user", "content": input_text}],
          )
          completion_tokens = litellm.token_counter(
              model=model,
              messages=[{"role": "user", "content": output_text}],
          )
          (
              prompt_tokens_cost_usd_dollar,
              completion_tokens_cost_usd_dollar,
          ) = litellm.cost_per_token(
              model=model,
              prompt_tokens=prompt_tokens,
              completion_tokens=completion_tokens,
          )
          cost = (
              prompt_tokens_cost_usd_dollar
              + completion_tokens_cost_usd_dollar
          )
      elif completion_obj:
          cost = litellm.completion_cost(
              completion_response=completion_obj
          )
          model = completion_obj[
              "model"
          ]  # if this throws an error try, model = completion_obj['model']
      else:
          raise ValueError(
              "Either a chat completion object or the text response needs to be passed in. Learn more - https://docs.litellm.ai/docs/budget_manager"
          )
  
      self.user_dict[user]["current_cost"] = cost + self.user_dict[
          user
      ].get("current_cost", 0)
      if "model_cost" in self.user_dict[user]:
          self.user_dict[user]["model_cost"][
              model
          ] = cost + self.user_dict[user]["model_cost"].get(model, 0)
      else:
          self.user_dict[user]["model_cost"] = {model: cost}
  
      self._save_data_thread()  # [Non-Blocking] Update persistent storage without blocking execution
      return {"user": self.user_dict[user]}
  
imports: import os, json, time
  import litellm
  from litellm.utils import ModelResponse
  import requests, threading
  from typing import Optional, Union, Literal
label_desc: Use image node_id 7 for calling the BudgetManager obj's underlying member method code with example usage: obj.update_cost(user, completion_obj, model, input_text, output_text) and returns: dict