AgentOps-AI / tokencost

Easy token price estimates for 400+ LLMs. TokenOps.
https://agentops.ai
MIT License
1.48k stars 61 forks source link

calculate_prompt_cost with gpt-4o is returning a warning message about gpt-4 #66

Closed baogorek closed 3 months ago

baogorek commented 4 months ago

Hi,

I've got tokencost @ git+https://github.com/AgentOps-AI/tokencost@6479a11 installed, and I'm running this introductory exmaple with a GPT-4o model:

model = "gpt-4o-2024-05-13"                                                                                                                 
prompt = [{ "role": "user", "content": "Hello world"}]                                                                                      
completion = "How may I assist you today?"                                                                                                  
prompt_cost = calculate_prompt_cost(prompt, model) 

There are no errors, but I am getting the warning:

WARNING:root:gpt-4 may update over time. Returning num tokens assuming gpt-4-0613.

Thus, it feels like the cost calculation is using another model than my input, which is in the JSON file as of this commit.

MorenoLabs commented 4 months ago

same here