From d0fae6cd54466685690baa5df9a1ee38e31d42c7 Mon Sep 17 00:00:00 2001 From: Marco Lamina Date: Thu, 16 May 2024 13:36:23 -0700 Subject: [PATCH] community: Add token cost for GPT-4o model (#21771) Adding [token cost for the new GPT-4o model](https://openai.com/api/pricing/): * Input cost US$5.00 / 1M tokens * Output cost US$15.00 / 1M tokens --- libs/community/langchain_community/callbacks/openai_info.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/community/langchain_community/callbacks/openai_info.py b/libs/community/langchain_community/callbacks/openai_info.py index 849f1e2532..532f133b26 100644 --- a/libs/community/langchain_community/callbacks/openai_info.py +++ b/libs/community/langchain_community/callbacks/openai_info.py @@ -6,6 +6,12 @@ from langchain_core.callbacks import BaseCallbackHandler from langchain_core.outputs import LLMResult MODEL_COST_PER_1K_TOKENS = { + # GPT-4o input + "gpt-4o": 0.005, + "gpt-4o-2024-05-13": 0.005, + # GPT-4o output + "gpt-4o-completion": 0.015, + "gpt-4o-2024-05-13-completion": 0.015, # GPT-4 input "gpt-4": 0.03, "gpt-4-0314": 0.03,