code: def get_openai_token_cost_for_model(
      model_name: str,
      num_tokens: int,
      is_completion: bool = False,
  ) -> float:
      """
      Get the cost in USD for a given model and number of tokens.
  
      Args:
          model_name (str): Name of the model
          num_tokens (int): Number of tokens.
          is_completion: Whether `num_tokens` refers to completion tokens or not.
              Defaults to False.
  
      Returns:
          float: Cost in USD.
      """
      model_name = standardize_model_name(
          model_name, is_completion=is_completion
      )
      if model_name not in MODEL_COST_PER_1K_TOKENS:
          raise ValueError(
              f"Unknown model: {model_name}. Please provide a valid OpenAI model name."
              "Known models are: "
              + ", ".join(MODEL_COST_PER_1K_TOKENS.keys())
          )
      return MODEL_COST_PER_1K_TOKENS[model_name] * (num_tokens / 1000)
  
file_path: pandas-ai/pandasai/helpers/openai_info.py
imports: from contextlib import contextmanager
  from contextvars import ContextVar
  from typing import Optional, Generator
label_desc: Use image node_id 2 for calling a global function with example usage: get_openai_token_cost_for_model(model_name, num_tokens, is_completion) and returns: unknown