From 6e2becc004699930845bd0557339b3d298df6c1f Mon Sep 17 00:00:00 2001 From: Takahito Ogawa Date: Fri, 13 Sep 2024 10:38:08 +0900 Subject: [PATCH] community[patch]: o1-preview and o1-mini costs --- .../langchain_community/callbacks/openai_info.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/community/langchain_community/callbacks/openai_info.py b/libs/community/langchain_community/callbacks/openai_info.py index 82489e7ba1388..7fbb0d097e1b9 100644 --- a/libs/community/langchain_community/callbacks/openai_info.py +++ b/libs/community/langchain_community/callbacks/openai_info.py @@ -8,6 +8,18 @@ from langchain_core.outputs import ChatGeneration, LLMResult MODEL_COST_PER_1K_TOKENS = { + # OpenAI o1-preview input + "o1-preview": 0.015, + "o1-preview-2024-09-12": 0.015, + # OpenAI o1-preview output + "o1-preview-completion": 0.06, + "o1-preview-2024-09-12-completion": 0.06, + # OpenAI o1-mini input + "o1-mini": 0.003, + "o1-mini-2024-09-12": 0.003, + # OpenAI o1-mini output + "o1-mini-completion": 0.012, + "o1-mini-2024-09-12-completion": 0.012, # GPT-4o-mini input "gpt-4o-mini": 0.00015, "gpt-4o-mini-2024-07-18": 0.00015, @@ -153,6 +165,7 @@ def standardize_model_name( model_name.startswith("gpt-4") or model_name.startswith("gpt-3.5") or model_name.startswith("gpt-35") + or model_name.startswith("o1-") or ("finetuned" in model_name and "legacy" not in model_name) ): return model_name + "-completion"