From 88a1fc75ccf656c76e9a2ddcdf8e969a95b86e26 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Sun, 9 Nov 2025 09:35:13 -0800 Subject: [PATCH] Track cost of claude haiku 4.5 model --- src/khoj/processor/conversation/utils.py | 1 + src/khoj/utils/constants.py | 2 ++ tests/conftest.py | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/khoj/processor/conversation/utils.py b/src/khoj/processor/conversation/utils.py index 1cba5281..e85da56c 100644 --- a/src/khoj/processor/conversation/utils.py +++ b/src/khoj/processor/conversation/utils.py @@ -84,6 +84,7 @@ model_to_prompt_size = { "claude-3-7-sonnet-20250219": 60000, "claude-3-7-sonnet-latest": 60000, "claude-3-5-haiku-20241022": 60000, + "claude-haiku-4-5-20251001": 60000, "claude-sonnet-4-0": 60000, "claude-sonnet-4-20250514": 60000, "claude-opus-4-0": 60000, diff --git a/src/khoj/utils/constants.py b/src/khoj/utils/constants.py index 25f718bb..d00b657b 100644 --- a/src/khoj/utils/constants.py +++ b/src/khoj/utils/constants.py @@ -69,6 +69,8 @@ model_to_cost: Dict[str, Dict[str, float]] = { "claude-opus-4@20250514": {"input": 15.0, "output": 75.0, "cache_read": 1.50, "cache_write": 18.75}, "claude-sonnet-4-5": {"input": 3.0, "output": 15.0, "cache_read": 0.3, "cache_write": 3.75}, "claude-sonnet-4-5-20250929": {"input": 3.0, "output": 15.0, "cache_read": 0.3, "cache_write": 3.75}, + "claude-haiku-4-5": {"input": 1.0, "output": 5.0, "cache_read": 0.08, "cache_write": 1.0}, + "claude-haiku-4-5-20251001": {"input": 1.0, "output": 5.0, "cache_read": 0.08, "cache_write": 1.0}, # Grok pricing: https://docs.x.ai/docs/models "grok-3": {"input": 3.0, "output": 15.0}, "grok-3-latest": {"input": 3.0, "output": 15.0}, diff --git a/tests/conftest.py b/tests/conftest.py index c8af0c93..297ad5be 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -248,7 +248,7 @@ def chat_client_builder(search_config, user, index_content=True, require_auth=Fa elif chat_provider == ChatModel.ModelType.GOOGLE: online_chat_model = ChatModelFactory(name="gemini-2.5-flash", model_type="google") elif chat_provider == ChatModel.ModelType.ANTHROPIC: - online_chat_model = ChatModelFactory(name="claude-3-5-haiku-20241022", model_type="anthropic") + online_chat_model = ChatModelFactory(name="claude-haiku-4-5-20251001", model_type="anthropic") if online_chat_model: online_chat_model.ai_model_api = AiModelApiFactory(api_key=get_chat_api_key(chat_provider)) UserConversationProcessorConfigFactory(user=user, setting=online_chat_model)