Merge branch 'dev' into team

This commit is contained in:
Sakurasan
2025-04-16 18:02:58 +08:00
2 changed files with 15 additions and 5 deletions

View File

@@ -109,14 +109,24 @@ func Cost(model string, promptCount, completionCount int) float64 {
cost = 0.015*float64(prompt/1000) + 0.06*float64(completion/1000)
case "o1-mini", "o1-mini-2024-09-12":
cost = 0.003*float64(prompt/1000) + 0.012*float64(completion/1000)
// Realtime API
// Audio*
// $0.1 / 1K input tokens
// $0.2 / 1K output tokens
case "o3-mini", "o3-mini-2025-01-31":
cost = 0.003*float64(prompt/1000) + 0.012*float64(completion/1000)
// Realtime API
// Audio*
// $0.1 / 1K input tokens
// $0.2 / 1K output tokens
case "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-12-17":
cost = 0.0025*float64(prompt/1000) + 0.01*float64(completion/1000)
case "gpt-4o-realtime-preview", "gpt-4o-realtime-preview-2024-10-01":
cost = 0.005*float64(prompt/1000) + 0.020*float64(completion/1000)
case "gpt-4o-realtime-preview.audio", "gpt-4o-realtime-preview-2024-10-01.audio":
cost = 0.1*float64(prompt/1000) + 0.2*float64(completion/1000)
case "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17":
cost = 0.00015*float64(prompt/1000) + 0.0006*float64(completion/1000)
case "gpt-4o-mini-realtime-preview", "gpt-4o-mini-realtime-preview-2024-12-17":
cost = 0.0006*float64(prompt/1000) + 0.0024*float64(completion/1000)
case "whisper-1":
// 0.006$/min
cost = 0.006 * float64(prompt+completion) / 60

View File

@@ -18,7 +18,7 @@ func ChatHandler(c *gin.Context) {
return
}
if strings.Contains(chatreq.Model, "gpt") || strings.HasPrefix(chatreq.Model, "o1-") {
if strings.Contains(chatreq.Model, "gpt") || strings.HasPrefix(chatreq.Model, "o1") || strings.HasPrefix(chatreq.Model, "o3") {
openai.ChatProxy(c, &chatreq)
return
}