Skip to content

Commit

Permalink
Merge pull request #1432 from iorisa/fixbug/1424
Browse files Browse the repository at this point in the history
fixbug: #1424 Add GPT-4o/GPT-4o-mini support
  • Loading branch information
better629 authored Aug 7, 2024
2 parents 833321c + f19fcfa commit 9d38a30
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion metagpt/utils/token_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"gpt-4-vision-preview": {"prompt": 0.01, "completion": 0.03}, # TODO add extra image price calculator
"gpt-4-1106-vision-preview": {"prompt": 0.01, "completion": 0.03},
"gpt-4o": {"prompt": 0.005, "completion": 0.015},
"gpt-4o-mini": {"prompt": 0.00015, "completion": 0.0006},
"gpt-4o-2024-05-13": {"prompt": 0.005, "completion": 0.015},
"text-embedding-ada-002": {"prompt": 0.0004, "completion": 0.0},
"glm-3-turbo": {"prompt": 0.0007, "completion": 0.0007}, # 128k version, prompt + completion tokens=0.005¥/k-tokens
Expand Down Expand Up @@ -202,6 +203,7 @@
"gpt-4-0613": 8192,
"gpt-4-32k": 32768,
"gpt-4-32k-0613": 32768,
"gpt-4o-mini": 128000,
"gpt-3.5-turbo-0125": 16385,
"gpt-3.5-turbo": 16385,
"gpt-3.5-turbo-1106": 16385,
Expand Down Expand Up @@ -347,8 +349,9 @@ def count_input_tokens(messages, model="gpt-3.5-turbo-0125"):
"gpt-4-turbo",
"gpt-4-vision-preview",
"gpt-4-1106-vision-preview",
"gpt-4o-2024-05-13",
"gpt-4o",
"gpt-4o-2024-05-13",
"gpt-4o-mini",
}:
tokens_per_message = 3 # # every reply is primed with <|start|>assistant<|message|>
tokens_per_name = 1
Expand Down

0 comments on commit 9d38a30

Please sign in to comment.