feat: sync models with OpenAI (#971)

* add new 0125 chat models and embedding-3 models

* refine the step of manually deploying

* add gpt-4-turbo-preview
This commit is contained in:
Benny 2024-01-28 16:09:21 +08:00 committed by GitHub
parent 4f214c48c6
commit 26e2e646cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 61 additions and 6 deletions

View File

@ -134,12 +134,12 @@ The initial account username is `root` and password is `123456`.
git clone https://github.com/songquanpeng/one-api.git git clone https://github.com/songquanpeng/one-api.git
# Build the frontend # Build the frontend
cd one-api/web cd one-api/web/default
npm install npm install
npm run build npm run build
# Build the backend # Build the backend
cd .. cd ../..
go mod download go mod download
go build -ldflags "-s -w" -o one-api go build -ldflags "-s -w" -o one-api
``` ```

View File

@ -135,12 +135,12 @@ sudo service nginx restart
git clone https://github.com/songquanpeng/one-api.git git clone https://github.com/songquanpeng/one-api.git
# フロントエンドのビルド # フロントエンドのビルド
cd one-api/web cd one-api/web/default
npm install npm install
npm run build npm run build
# バックエンドのビルド # バックエンドのビルド
cd .. cd ../..
go mod download go mod download
go build -ldflags "-s -w" -o one-api go build -ldflags "-s -w" -o one-api
``` ```

View File

@ -174,12 +174,12 @@ docker-compose ps
git clone https://github.com/songquanpeng/one-api.git git clone https://github.com/songquanpeng/one-api.git
# 构建前端 # 构建前端
cd one-api/web cd one-api/web/default
npm install npm install
npm run build npm run build
# 构建后端 # 构建后端
cd .. cd ../..
go mod download go mod download
go build -ldflags "-s -w" -o one-api go build -ldflags "-s -w" -o one-api
```` ````

View File

@ -45,6 +45,8 @@ var ModelRatio = map[string]float64{
"gpt-4-32k-0314": 30, "gpt-4-32k-0314": 30,
"gpt-4-32k-0613": 30, "gpt-4-32k-0613": 30,
"gpt-4-1106-preview": 5, // $0.01 / 1K tokens "gpt-4-1106-preview": 5, // $0.01 / 1K tokens
"gpt-4-0125-preview": 5, // $0.01 / 1K tokens
"gpt-4-turbo-preview": 5, // $0.01 / 1K tokens
"gpt-4-vision-preview": 5, // $0.01 / 1K tokens "gpt-4-vision-preview": 5, // $0.01 / 1K tokens
"gpt-3.5-turbo": 0.75, // $0.0015 / 1K tokens "gpt-3.5-turbo": 0.75, // $0.0015 / 1K tokens
"gpt-3.5-turbo-0301": 0.75, "gpt-3.5-turbo-0301": 0.75,
@ -53,6 +55,7 @@ var ModelRatio = map[string]float64{
"gpt-3.5-turbo-16k-0613": 1.5, "gpt-3.5-turbo-16k-0613": 1.5,
"gpt-3.5-turbo-instruct": 0.75, // $0.0015 / 1K tokens "gpt-3.5-turbo-instruct": 0.75, // $0.0015 / 1K tokens
"gpt-3.5-turbo-1106": 0.5, // $0.001 / 1K tokens "gpt-3.5-turbo-1106": 0.5, // $0.001 / 1K tokens
"gpt-3.5-turbo-0125": 0.25, // $0.0005 / 1K tokens
"davinci-002": 1, // $0.002 / 1K tokens "davinci-002": 1, // $0.002 / 1K tokens
"babbage-002": 0.2, // $0.0004 / 1K tokens "babbage-002": 0.2, // $0.0004 / 1K tokens
"text-ada-001": 0.2, "text-ada-001": 0.2,
@ -72,6 +75,8 @@ var ModelRatio = map[string]float64{
"babbage": 10, "babbage": 10,
"ada": 10, "ada": 10,
"text-embedding-ada-002": 0.05, "text-embedding-ada-002": 0.05,
"text-embedding-3-small": 0.01,
"text-embedding-3-large": 0.065,
"text-search-ada-doc-001": 10, "text-search-ada-doc-001": 10,
"text-moderation-stable": 0.1, "text-moderation-stable": 0.1,
"text-moderation-latest": 0.1, "text-moderation-latest": 0.1,
@ -132,6 +137,11 @@ func GetModelRatio(name string) float64 {
func GetCompletionRatio(name string) float64 { func GetCompletionRatio(name string) float64 {
if strings.HasPrefix(name, "gpt-3.5") { if strings.HasPrefix(name, "gpt-3.5") {
if strings.HasSuffix(name, "0125") {
// https://openai.com/blog/new-embedding-models-and-api-updates
// Updated GPT-3.5 Turbo model and lower pricing
return 3
}
if strings.HasSuffix(name, "1106") { if strings.HasSuffix(name, "1106") {
return 2 return 2
} }

View File

@ -171,6 +171,15 @@ func init() {
Root: "gpt-3.5-turbo-1106", Root: "gpt-3.5-turbo-1106",
Parent: nil, Parent: nil,
}, },
{
Id: "gpt-3.5-turbo-0125",
Object: "model",
Created: 1706232090,
OwnedBy: "openai",
Permission: permission,
Root: "gpt-3.5-turbo-0125",
Parent: nil,
},
{ {
Id: "gpt-3.5-turbo-instruct", Id: "gpt-3.5-turbo-instruct",
Object: "model", Object: "model",
@ -243,6 +252,24 @@ func init() {
Root: "gpt-4-1106-preview", Root: "gpt-4-1106-preview",
Parent: nil, Parent: nil,
}, },
{
Id: "gpt-4-0125-preview",
Object: "model",
Created: 1706232090,
OwnedBy: "openai",
Permission: permission,
Root: "gpt-4-0125-preview",
Parent: nil,
},
{
Id: "gpt-4-turbo-preview",
Object: "model",
Created: 1706232090,
OwnedBy: "openai",
Permission: permission,
Root: "gpt-4-turbo-preview",
Parent: nil,
},
{ {
Id: "gpt-4-vision-preview", Id: "gpt-4-vision-preview",
Object: "model", Object: "model",
@ -261,6 +288,24 @@ func init() {
Root: "text-embedding-ada-002", Root: "text-embedding-ada-002",
Parent: nil, Parent: nil,
}, },
{
Id: "text-embedding-3-small",
Object: "model",
Created: 1706232090,
OwnedBy: "openai",
Permission: permission,
Root: "text-embedding-3-small",
Parent: nil,
},
{
Id: "text-embedding-3-large",
Object: "model",
Created: 1706232090,
OwnedBy: "openai",
Permission: permission,
Root: "text-embedding-3-large",
Parent: nil,
},
{ {
Id: "text-davinci-003", Id: "text-davinci-003",
Object: "model", Object: "model",