From c1aa5a16d3e1893e95373d5f0e60c7c72eb2a0a8 Mon Sep 17 00:00:00 2001 From: st4r0 <73290287+st4r0@users.noreply.github.com> Date: Mon, 20 May 2024 01:12:47 +0200 Subject: [PATCH] Fix handling of snapshot_ids ("gpt-4-turbo-2024-04-09" and "gpt-4o-2024-05-13") and alias "gpt-4-turbo". (#672) Co-authored-by: rstaneker --- instructor/cli/usage.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/instructor/cli/usage.py b/instructor/cli/usage.py index ce8db225b..3b1a3443c 100644 --- a/instructor/cli/usage.py +++ b/instructor/cli/usage.py @@ -50,6 +50,9 @@ async def get_usage_for_past_n_days(n_days: int) -> list[dict[str, Any]]: # Define the cost per unit for each model MODEL_COSTS = { "gpt-4o": {"prompt": 0.005 / 1000, "completion": 0.015 / 1000}, + "gpt-4o-2024-05-13": {"prompt": 0.005 / 1000, "completion": 0.015 / 1000}, + "gpt-4-turbo": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000}, + "gpt-4-turbo-2024-04-09": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000}, "gpt-4-0125-preview": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000}, "gpt-4-turbo-preview": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000}, "gpt-4-1106-preview": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000}, @@ -85,8 +88,12 @@ def get_model_cost( return MODEL_COSTS["gpt-3.5-turbo-16k"] elif model.startswith("gpt-3.5-turbo"): return MODEL_COSTS["gpt-3.5-turbo"] + elif model.startswith("gpt-4-turbo"): + return MODEL_COSTS["gpt-4-turbo-preview"] elif model.startswith("gpt-4-32k"): return MODEL_COSTS["gpt-4-32k"] + elif model.startswith("gpt-4o"): + return MODEL_COSTS["gpt-4o"] elif model.startswith("gpt-4"): return MODEL_COSTS["gpt-4"] else: