| 150 | |
| 151 | |
| 152 | def cal_cost(response_json, model_name): |
| 153 | model_cost = { |
| 154 | # gpt-4.1 |
| 155 | "gpt-4.1": {"input": 2.00, "cached_input": 0.50, "output": 8.00}, |
| 156 | "gpt-4.1-2025-04-14": {"input": 2.00, "cached_input": 0.50, "output": 8.00}, |
| 157 | |
| 158 | # gpt-4.1-mini |
| 159 | "gpt-4.1-mini": {"input": 0.40, "cached_input": 0.10, "output": 1.60}, |
| 160 | "gpt-4.1-mini-2025-04-14": {"input": 0.40, "cached_input": 0.10, "output": 1.60}, |
| 161 | |
| 162 | # gpt-4.1-nano |
| 163 | "gpt-4.1-nano": {"input": 0.10, "cached_input": 0.025, "output": 0.40}, |
| 164 | "gpt-4.1-nano-2025-04-14": {"input": 0.10, "cached_input": 0.025, "output": 0.40}, |
| 165 | |
| 166 | # gpt-4.5-preview |
| 167 | "gpt-4.5-preview": {"input": 75.00, "cached_input": 37.50, "output": 150.00}, |
| 168 | "gpt-4.5-preview-2025-02-27": {"input": 75.00, "cached_input": 37.50, "output": 150.00}, |
| 169 | |
| 170 | # gpt-4o |
| 171 | "gpt-4o": {"input": 2.50, "cached_input": 1.25, "output": 10.00}, |
| 172 | "gpt-4o-2024-08-06": {"input": 2.50, "cached_input": 1.25, "output": 10.00}, |
| 173 | "gpt-4o-2024-11-20": {"input": 2.50, "cached_input": 1.25, "output": 10.00}, |
| 174 | "gpt-4o-2024-05-13": {"input": 5.00, "cached_input": None, "output": 15.00}, |
| 175 | |
| 176 | # gpt-4o-audio-preview |
| 177 | "gpt-4o-audio-preview": {"input": 2.50, "cached_input": None, "output": 10.00}, |
| 178 | "gpt-4o-audio-preview-2024-12-17": {"input": 2.50, "cached_input": None, "output": 10.00}, |
| 179 | "gpt-4o-audio-preview-2024-10-01": {"input": 2.50, "cached_input": None, "output": 10.00}, |
| 180 | |
| 181 | # gpt-4o-realtime-preview |
| 182 | "gpt-4o-realtime-preview": {"input": 5.00, "cached_input": 2.50, "output": 20.00}, |
| 183 | "gpt-4o-realtime-preview-2024-12-17": {"input": 5.00, "cached_input": 2.50, "output": 20.00}, |
| 184 | "gpt-4o-realtime-preview-2024-10-01": {"input": 5.00, "cached_input": 2.50, "output": 20.00}, |
| 185 | |
| 186 | # gpt-4o-mini |
| 187 | "gpt-4o-mini": {"input": 0.15, "cached_input": 0.075, "output": 0.60}, |
| 188 | "gpt-4o-mini-2024-07-18": {"input": 0.15, "cached_input": 0.075, "output": 0.60}, |
| 189 | |
| 190 | # gpt-4o-mini-audio-preview |
| 191 | "gpt-4o-mini-audio-preview": {"input": 0.15, "cached_input": None, "output": 0.60}, |
| 192 | "gpt-4o-mini-audio-preview-2024-12-17": {"input": 0.15, "cached_input": None, "output": 0.60}, |
| 193 | |
| 194 | # gpt-4o-mini-realtime-preview |
| 195 | "gpt-4o-mini-realtime-preview": {"input": 0.60, "cached_input": 0.30, "output": 2.40}, |
| 196 | "gpt-4o-mini-realtime-preview-2024-12-17": {"input": 0.60, "cached_input": 0.30, "output": 2.40}, |
| 197 | |
| 198 | # o1 |
| 199 | "o1": {"input": 15.00, "cached_input": 7.50, "output": 60.00}, |
| 200 | "o1-2024-12-17": {"input": 15.00, "cached_input": 7.50, "output": 60.00}, |
| 201 | "o1-preview-2024-09-12": {"input": 15.00, "cached_input": 7.50, "output": 60.00}, |
| 202 | |
| 203 | # o1-pro |
| 204 | "o1-pro": {"input": 150.00, "cached_input": None, "output": 600.00}, |
| 205 | "o1-pro-2025-03-19": {"input": 150.00, "cached_input": None, "output": 600.00}, |
| 206 | |
| 207 | # o3 |
| 208 | "o3": {"input": 10.00, "cached_input": 2.50, "output": 40.00}, |
| 209 | "o3-2025-04-16": {"input": 10.00, "cached_input": 2.50, "output": 40.00}, |