4
4
@dataclass
5
5
class Model :
6
6
name : str
7
- prompt_token_cost : float # per 1k
8
- completion_token_cost : float # per 1k
9
- max_tokens : int
10
- json_mode : bool
7
+ prompt_token_cost : float # $ per 1k input tokens, see https://openai.com/api/pricing
8
+ completion_token_cost : float # $ per 1k output tokens, see https://openai.com/api/pricing
9
+ max_tokens : int # max output tokens
10
+ json_mode : bool # see https://platform.openai.com/docs/guides/json-mode
11
11
12
12
def cost (self , prompt_tokens : int , completion_tokens : int ) -> float :
13
13
return (
@@ -20,6 +20,10 @@ def cost(self, prompt_tokens: int, completion_tokens: int) -> float:
20
20
Model ("gpt-4" , 0.03 , 0.06 , 8192 , False ),
21
21
Model ("gpt-4-32k" , 0.06 , 0.12 , 32768 , False ),
22
22
Model ("gpt-4-1106-preview" , 0.01 , 0.03 , 128000 , True ),
23
+ Model ("gpt-4-turbo" , 0.01 , 0.03 , 4096 , True ),
24
+ Model ("gpt-4-turbo-preview" , 0.01 , 0.03 , 4096 , True ),
25
+ Model ("gpt-4o" , 0.005 , 0.015 , 4096 , True ),
26
+ Model ("gpt-4o-mini" , 0.00015 , 0.0006 , 16384 , True ),
23
27
Model ("gpt-3.5-turbo" , 0.001 , 0.002 , 16384 , False ),
24
28
Model ("gpt-3.5-turbo-1106" , 0.001 , 0.002 , 16384 , True ),
25
29
]
0 commit comments