mirror of
				https://github.com/songquanpeng/one-api.git
				synced 2025-11-04 15:53:42 +08:00 
			
		
		
		
	fix: remove deprecated gemini model references and update pricing ratios
This commit is contained in:
		@@ -27,7 +27,6 @@ func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error) {
 | 
			
		||||
	var defaultVersion string
 | 
			
		||||
	switch meta.ActualModelName {
 | 
			
		||||
	case "gemini-2.0-flash-exp",
 | 
			
		||||
		"gemini-2.0-flash-thinking-exp",
 | 
			
		||||
		"gemini-2.0-flash-thinking-exp-01-21":
 | 
			
		||||
		defaultVersion = "v1beta"
 | 
			
		||||
	default:
 | 
			
		||||
 
 | 
			
		||||
@@ -7,5 +7,5 @@ var ModelList = []string{
 | 
			
		||||
	"gemini-1.5-flash", "gemini-1.5-pro",
 | 
			
		||||
	"text-embedding-004", "aqa",
 | 
			
		||||
	"gemini-2.0-flash-exp",
 | 
			
		||||
	"gemini-2.0-flash-thinking-exp", "gemini-2.0-flash-thinking-exp-01-21",
 | 
			
		||||
	"gemini-2.0-flash-thinking-exp-01-21",
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,18 +8,18 @@ import (
 | 
			
		||||
	"github.com/songquanpeng/one-api/common/ctxkey"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/gemini"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/openai"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/relaymode"
 | 
			
		||||
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/meta"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/model"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/relaymode"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var ModelList = []string{
 | 
			
		||||
	"gemini-pro", "gemini-pro-vision",
 | 
			
		||||
	"gemini-1.5-pro-001", "gemini-1.5-flash-001",
 | 
			
		||||
	"gemini-1.5-pro-002", "gemini-1.5-flash-002",
 | 
			
		||||
	"gemini-exp-1206",
 | 
			
		||||
	"gemini-1.5-pro-001", "gemini-1.5-pro-002",
 | 
			
		||||
	"gemini-1.5-flash-001", "gemini-1.5-flash-002",
 | 
			
		||||
	"gemini-2.0-flash-exp",
 | 
			
		||||
	"gemini-2.0-flash-thinking-exp", "gemini-2.0-flash-thinking-exp-01-21",
 | 
			
		||||
	"gemini-2.0-flash-thinking-exp-01-21",
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Adaptor struct {
 | 
			
		||||
 
 | 
			
		||||
@@ -117,15 +117,14 @@ var ModelRatio = map[string]float64{
 | 
			
		||||
	"bge-large-en":       0.002 * RMB,
 | 
			
		||||
	"tao-8k":             0.002 * RMB,
 | 
			
		||||
	// https://ai.google.dev/pricing
 | 
			
		||||
	"gemini-pro":                          1, // $0.00025 / 1k characters -> $0.001 / 1k tokens
 | 
			
		||||
	"gemini-1.0-pro":                      1,
 | 
			
		||||
	"gemini-1.5-pro":                      1,
 | 
			
		||||
	"gemini-1.5-pro-001":                  1,
 | 
			
		||||
	"gemini-1.5-flash":                    1,
 | 
			
		||||
	"gemini-1.5-flash-001":                1,
 | 
			
		||||
	"gemini-2.0-flash-exp":                1,
 | 
			
		||||
	"gemini-2.0-flash-thinking-exp":       1,
 | 
			
		||||
	"gemini-2.0-flash-thinking-exp-01-21": 1,
 | 
			
		||||
	"gemini-pro":                          0.25 * MILLI_USD, // $0.00025 / 1k characters -> $0.001 / 1k tokens
 | 
			
		||||
	"gemini-1.0-pro":                      0.125 * MILLI_USD,
 | 
			
		||||
	"gemini-1.5-pro":                      1.25 * MILLI_USD,
 | 
			
		||||
	"gemini-1.5-pro-001":                  1.25 * MILLI_USD,
 | 
			
		||||
	"gemini-1.5-flash":                    0.075 * MILLI_USD,
 | 
			
		||||
	"gemini-1.5-flash-001":                0.075 * MILLI_USD,
 | 
			
		||||
	"gemini-2.0-flash-exp":                0.075 * MILLI_USD,
 | 
			
		||||
	"gemini-2.0-flash-thinking-exp-01-21": 0.075 * MILLI_USD,
 | 
			
		||||
	"aqa":                                 1,
 | 
			
		||||
	// https://open.bigmodel.cn/pricing
 | 
			
		||||
	"glm-4":         0.1 * RMB,
 | 
			
		||||
@@ -566,7 +565,7 @@ func GetCompletionRatio(name string, channelType int) float64 {
 | 
			
		||||
		return 3
 | 
			
		||||
	}
 | 
			
		||||
	if strings.HasPrefix(name, "gemini-") {
 | 
			
		||||
		return 3
 | 
			
		||||
		return 4
 | 
			
		||||
	}
 | 
			
		||||
	if strings.HasPrefix(name, "deepseek-") {
 | 
			
		||||
		return 2
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user