-# One API
+# CZL Oapi
_✨ Access all LLM through the standard OpenAI API format, easy to deploy & use ✨_
@@ -197,7 +197,7 @@ If you encounter a blank page after deployment, refer to [#97](https://github.co
6. Automatic deployment will start, but please cancel it for now. Go to the Variable tab, add a `PORT` with a value of `3000`, and then add a `SQL_DSN` with a value of `:@tcp(:)/one-api`. Save the changes. Please note that if `SQL_DSN` is not set, data will not be persisted, and the data will be lost after redeployment.
7. Select Redeploy.
8. In the Domains tab, select a suitable domain name prefix, such as "my-one-api". The final domain name will be "my-one-api.zeabur.app". You can also CNAME your own domain name.
-9. Wait for the deployment to complete, and click on the generated domain name to access One API.
+9. Wait for the deployment to complete, and click on the generated domain name to access CZL Oapi.
@@ -212,16 +212,16 @@ After the system starts, log in as the `root` user to further configure the syst
## Usage
Add your API Key on the `Channels` page, and then add an access token on the `Tokens` page.
-You can then use your access token to access One API. The usage is consistent with the [OpenAI API](https://platform.openai.com/docs/api-reference/introduction).
+You can then use your access token to access CZL Oapi. The usage is consistent with the [OpenAI API](https://platform.openai.com/docs/api-reference/introduction).
-In places where the OpenAI API is used, remember to set the API Base to your One API deployment address, for example: `https://openai.justsong.cn`. The API Key should be the token generated in One API.
+In places where the OpenAI API is used, remember to set the API Base to your CZL Oapi deployment address, for example: `https://openai.justsong.cn`. The API Key should be the token generated in CZL Oapi.
Note that the specific API Base format depends on the client you are using.
```mermaid
graph LR
A(User)
- A --->|Request| B(One API)
+ A --->|Request| B(CZL Oapi)
B -->|Relay Request| C(OpenAI)
B -->|Relay Request| D(Azure)
B -->|Relay Request| E(Other downstream channels)
@@ -265,7 +265,7 @@ If the channel ID is not provided, load balancing will be used to distribute the

## FAQ
-1. What is quota? How is it calculated? Does One API have quota calculation issues?
+1. What is quota? How is it calculated? Does CZL Oapi have quota calculation issues?
+ Quota = Group multiplier * Model multiplier * (number of prompt tokens + number of completion tokens * completion multiplier)
+ The completion multiplier is fixed at 1.33 for GPT3.5 and 2 for GPT4, consistent with the official definition.
+ If it is not a stream mode, the official API will return the total number of tokens consumed. However, please note that the consumption multipliers for prompts and completions are different.
diff --git a/README.ja.md b/README.ja.md
index fa3339c2..28694348 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -3,12 +3,12 @@
-
+
-# One API
+# CZL Oapi
_✨ 標準的な OpenAI API フォーマットを通じてすべての LLM にアクセスでき、導入と利用が容易です ✨_
@@ -198,7 +198,7 @@ Please refer to the [environment variables](#environment-variables) section for
6. 自動デプロイが開始されますが、一旦キャンセルしてください。Variable タブで `PORT` に `3000` を追加し、`SQL_DSN` に `:@tcp(:)/one-api` を追加します。変更を保存する。SQL_DSN` が設定されていないと、データが永続化されず、再デプロイ後にデータが失われるので注意すること。
7. 再デプロイを選択します。
8. Domains タブで、"my-one-api" のような適切なドメイン名の接頭辞を選択する。最終的なドメイン名は "my-one-api.zeabur.app" となります。独自のドメイン名を CNAME することもできます。
-9. デプロイが完了するのを待ち、生成されたドメイン名をクリックして One API にアクセスします。
+9. デプロイが完了するのを待ち、生成されたドメイン名をクリックして CZL Oapi にアクセスします。
@@ -213,16 +213,16 @@ Please refer to the [environment variables](#environment-variables) section for
## 使用方法
`Channels` ページで API Key を追加し、`Tokens` ページでアクセストークンを追加する。
-アクセストークンを使って One API にアクセスすることができる。使い方は [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) と同じです。
+アクセストークンを使って CZL Oapi にアクセスすることができる。使い方は [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) と同じです。
-OpenAI API が使用されている場所では、API Base に One API のデプロイアドレスを設定することを忘れないでください(例: `https://openai.justsong.cn`)。API Key は One API で生成されたトークンでなければなりません。
+OpenAI API が使用されている場所では、API Base に CZL Oapi のデプロイアドレスを設定することを忘れないでください(例: `https://openai.justsong.cn`)。API Key は CZL Oapi で生成されたトークンでなければなりません。
具体的な API Base のフォーマットは、使用しているクライアントに依存することに注意してください。
```mermaid
graph LR
A(ユーザ)
- A --->|リクエスト| B(One API)
+ A --->|リクエスト| B(CZL Oapi)
B -->|中継リクエスト| C(OpenAI)
B -->|中継リクエスト| D(Azure)
B -->|中継リクエスト| E(その他のダウンストリームチャンネル)
@@ -266,7 +266,7 @@ graph LR

## FAQ
-1. ノルマとは何か?どのように計算されますか?One API にはノルマ計算の問題はありますか?
+1. ノルマとは何か?どのように計算されますか?CZL Oapi にはノルマ計算の問題はありますか?
+ ノルマ = グループ倍率 * モデル倍率 * (プロンプトトークンの数 + 完了トークンの数 * 完了倍率)
+ 完了倍率は、公式の定義と一致するように、GPT3.5 では 1.33、GPT4 では 2 に固定されています。
+ ストリームモードでない場合、公式 API は消費したトークンの総数を返す。ただし、プロンプトとコンプリートの消費倍率は異なるので注意してください。
diff --git a/README.md b/README.md
index 5d807e2d..22e8b645 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,12 @@
-
+
-# One API
+# CZL Oapi
_✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用 ✨_
@@ -201,7 +201,7 @@ sudo service nginx restart
如果部署后访问出现空白页面,详见 [#97](https://github.com/songquanpeng/one-api/issues/97)。
-### 部署第三方服务配合 One API 使用
+### 部署第三方服务配合 CZL Oapi 使用
> 欢迎 PR 添加更多示例。
#### ChatGPT Next Web
@@ -225,7 +225,7 @@ docker run --name chatgpt-web -d -p 3002:3002 -e OPENAI_API_BASE_URL=https://ope
#### QChatGPT - QQ机器人
项目主页:https://github.com/RockChinQ/QChatGPT
-根据文档完成部署后,在`config.py`设置配置项`openai_config`的`reverse_proxy`为 One API 后端地址,设置`api_key`为 One API 生成的key,并在配置项`completion_api_params`的`model`参数设置为 One API 支持的模型名称。
+根据文档完成部署后,在`config.py`设置配置项`openai_config`的`reverse_proxy`为 CZL Oapi 后端地址,设置`api_key`为 CZL Oapi 生成的key,并在配置项`completion_api_params`的`model`参数设置为 CZL Oapi 支持的模型名称。
可安装 [Switcher 插件](https://github.com/RockChinQ/Switcher)在运行时切换所使用的模型。
@@ -257,7 +257,7 @@ docker run --name chatgpt-web -d -p 3002:3002 -e OPENAI_API_BASE_URL=https://ope
6. Deploy 会自动开始,先取消。进入下方 Variable,添加一个 `PORT`,值为 `3000`,再添加一个 `SQL_DSN`,值为 `:@tcp(:)/one-api` ,然后保存。 注意如果不填写 `SQL_DSN`,数据将无法持久化,重新部署后数据会丢失。
7. 选择 Redeploy。
8. 进入下方 Domains,选择一个合适的域名前缀,如 "my-one-api",最终域名为 "my-one-api.zeabur.app",也可以 CNAME 自己的域名。
-9. 等待部署完成,点击生成的域名进入 One API。
+9. 等待部署完成,点击生成的域名进入 CZL Oapi。
@@ -285,9 +285,9 @@ Render 可以直接部署 docker 镜像,不需要 fork 仓库:https://dashbo
## 使用方法
在`渠道`页面中添加你的 API Key,之后在`令牌`页面中新增访问令牌。
-之后就可以使用你的令牌访问 One API 了,使用方式与 [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) 一致。
+之后就可以使用你的令牌访问 CZL Oapi 了,使用方式与 [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) 一致。
-你需要在各种用到 OpenAI API 的地方设置 API Base 为你的 One API 的部署地址,例如:`https://openai.justsong.cn`,API Key 则为你在 One API 中生成的令牌。
+你需要在各种用到 OpenAI API 的地方设置 API Base 为你的 CZL Oapi 的部署地址,例如:`https://openai.justsong.cn`,API Key 则为你在 CZL Oapi 中生成的令牌。
注意,具体的 API Base 的格式取决于你所使用的客户端。
@@ -300,7 +300,7 @@ OPENAI_API_BASE="https://:/v1"
```mermaid
graph LR
A(用户)
- A --->|使用 One API 分发的 key 进行请求| B(One API)
+ A --->|使用 CZL Oapi 分发的 key 进行请求| B(CZL Oapi)
B -->|中继请求| C(OpenAI)
B -->|中继请求| D(Azure)
B -->|中继请求| E(其他 OpenAI API 格式下游渠道)
@@ -371,11 +371,11 @@ https://openai.justsong.cn

## 常见问题
-1. 额度是什么?怎么计算的?One API 的额度计算有问题?
+1. 额度是什么?怎么计算的?CZL Oapi 的额度计算有问题?
+ 额度 = 分组倍率 * 模型倍率 * (提示 token 数 + 补全 token 数 * 补全倍率)
+ 其中补全倍率对于 GPT3.5 固定为 1.33,GPT4 为 2,与官方保持一致。
+ 如果是非流模式,官方接口会返回消耗的总 token,但是你要注意提示和补全的消耗倍率不一样。
- + 注意,One API 的默认倍率就是官方倍率,是已经调整过的。
+ + 注意,CZL Oapi 的默认倍率就是官方倍率,是已经调整过的。
2. 账户额度足够为什么提示额度不足?
+ 请检查你的令牌额度是否足够,这个和账户额度是分开的。
+ 令牌额度仅供用户设置最大使用量,用户可自由设置。
diff --git a/common/constants.go b/common/constants.go
index a0361c35..21b61dba 100644
--- a/common/constants.go
+++ b/common/constants.go
@@ -11,7 +11,7 @@ import (
var StartTime = time.Now().Unix() // unit: second
var Version = "v0.0.0" // this hard coding will be replaced automatically when building, no need to manually change
-var SystemName = "One API"
+var SystemName = "CZL Oapi"
var ServerAddress = "http://localhost:3000"
var Footer = ""
var Logo = ""
@@ -31,7 +31,7 @@ var SQLitePath = "one-api.db"
var OptionMap map[string]string
var OptionMapRWMutex sync.RWMutex
-var ItemsPerPage = 10
+var ItemsPerPage = 20
var MaxRecentItems = 100
var PasswordLoginEnabled = true
diff --git a/common/init.go b/common/init.go
index 1e9c85ce..3b64313b 100644
--- a/common/init.go
+++ b/common/init.go
@@ -16,9 +16,8 @@ var (
)
func printHelp() {
- fmt.Println("One API " + Version + " - All in one API service for OpenAI API.")
- fmt.Println("Copyright (C) 2023 JustSong. All rights reserved.")
- fmt.Println("GitHub: https://github.com/songquanpeng/one-api")
+ fmt.Println("CZL Oapi " + Version + " - All in CZL Oapi service for OpenAI API.")
+ fmt.Println("Copyright (C) 2023 CZL. All rights reserved.")
fmt.Println("Usage: one-api [--port ] [--log-dir ] [--version] [--help]")
}
diff --git a/controller/billing.go b/controller/billing.go
index 42e86aea..7bdf6c0a 100644
--- a/controller/billing.go
+++ b/controller/billing.go
@@ -71,7 +71,7 @@ func GetUsage(c *gin.Context) {
if err != nil {
openAIError := OpenAIError{
Message: err.Error(),
- Type: "one_api_error",
+ Type: "czloapi_error",
}
c.JSON(200, gin.H{
"error": openAIError,
diff --git a/controller/relay-text.go b/controller/relay-text.go
index db1ec3a2..234c7e5d 100644
--- a/controller/relay-text.go
+++ b/controller/relay-text.go
@@ -341,7 +341,7 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
req.Header.Set("Authorization", c.Request.Header.Get("Authorization"))
if channelType == common.ChannelTypeOpenRouter {
req.Header.Set("HTTP-Referer", "https://github.com/songquanpeng/one-api")
- req.Header.Set("X-Title", "One API")
+ req.Header.Set("X-Title", "CZL Oapi")
}
}
case APITypeClaude:
diff --git a/controller/relay-utils.go b/controller/relay-utils.go
index 4775ec88..71791877 100644
--- a/controller/relay-utils.go
+++ b/controller/relay-utils.go
@@ -117,7 +117,7 @@ func countTokenText(text string, model string) int {
func errorWrapper(err error, code string, statusCode int) *OpenAIErrorWithStatusCode {
openAIError := OpenAIError{
Message: err.Error(),
- Type: "one_api_error",
+ Type: "czloapi_error",
Code: code,
}
return &OpenAIErrorWithStatusCode{
diff --git a/controller/relay.go b/controller/relay.go
index 1926110e..d0d2f137 100644
--- a/controller/relay.go
+++ b/controller/relay.go
@@ -227,7 +227,7 @@ func Relay(c *gin.Context) {
func RelayNotImplemented(c *gin.Context) {
err := OpenAIError{
Message: "API not implemented",
- Type: "one_api_error",
+ Type: "czloapi_error",
Param: "",
Code: "api_not_implemented",
}
diff --git a/i18n/en.json b/i18n/en.json
index 9b2ca4c8..89ba6cf3 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -242,7 +242,7 @@
"保存首页内容": "Save Home Page Content",
"在此输入新的关于内容,支持 Markdown & HTML 代码。如果输入的是一个链接,则会使用该链接作为 iframe 的 src 属性,这允许你设置任意网页作为关于页面": "Enter new about content here, supports Markdown & HTML code. If a link is entered, it will be used as the src attribute of the iframe, allowing you to set any webpage as the about page.",
"保存关于": "Save About",
- "移除 One API 的版权标识必须首先获得授权,项目维护需要花费大量精力,如果本项目对你有意义,请主动支持本项目": "Removal of One API copyright mark must first be authorized. Project maintenance requires a lot of effort. If this project is meaningful to you, please actively support it.",
+ "移除 CZL Oapi 的版权标识必须首先获得授权,项目维护需要花费大量精力,如果本项目对你有意义,请主动支持本项目": "Removal of CZL Oapi copyright mark must first be authorized. Project maintenance requires a lot of effort. If this project is meaningful to you, please actively support it.",
"页脚": "Footer",
"在此输入新的页脚,留空则使用默认页脚,支持 HTML 代码": "Enter the new footer here, leave blank to use the default footer, supports HTML code.",
"设置页脚": "Set Footer",
@@ -505,7 +505,7 @@
"请输入显示名称": "Please enter display name",
"请输入密码": "Please enter password",
"模型部署名称必须和模型名称保持一致": "The model deployment name must be consistent with the model name",
- ",因为 One API 会把请求体中的 model": ", because One API will take the model in the request body",
+ ",因为 CZL Oapi 会把请求体中的 model": ", because CZL Oapi will take the model in the request body",
"请输入 AZURE_OPENAI_ENDPOINT": "Please enter AZURE_OPENAI_ENDPOINT",
"请输入自定义渠道的 Base URL": "Please enter the Base URL of the custom channel",
"Homepage URL 填": "Fill in the Homepage URL",
diff --git a/main.go b/main.go
index 88938516..b7c1e70c 100644
--- a/main.go
+++ b/main.go
@@ -23,7 +23,7 @@ var indexPage []byte
func main() {
common.SetupLogger()
- common.SysLog("One API " + common.Version + " started")
+ common.SysLog("CZL Oapi " + common.Version + " started")
if os.Getenv("GIN_MODE") != "debug" {
gin.SetMode(gin.ReleaseMode)
}
diff --git a/middleware/utils.go b/middleware/utils.go
index 536125cc..19b4cc57 100644
--- a/middleware/utils.go
+++ b/middleware/utils.go
@@ -9,7 +9,7 @@ func abortWithMessage(c *gin.Context, statusCode int, message string) {
c.JSON(statusCode, gin.H{
"error": gin.H{
"message": common.MessageWithRequestId(message, c.GetString(common.RequestIdKey)),
- "type": "one_api_error",
+ "type": "czloapi_error",
},
})
c.Abort()
diff --git a/model/channel.go b/model/channel.go
index 091a0d71..e79ec9b2 100644
--- a/model/channel.go
+++ b/model/channel.go
@@ -45,11 +45,7 @@ func SearchChannels(keyword string) (channels []*Channel, err error) {
func GetChannelById(id int, selectAll bool) (*Channel, error) {
channel := Channel{Id: id}
var err error = nil
- if selectAll {
- err = DB.First(&channel, "id = ?", id).Error
- } else {
- err = DB.Omit("key").First(&channel, "id = ?", id).Error
- }
+ err = DB.First(&channel, "id = ?", id).Error
return &channel, err
}
diff --git a/one-api.service b/one-api.service
index 17e236bc..3dcddb8a 100644
--- a/one-api.service
+++ b/one-api.service
@@ -4,7 +4,7 @@
# sudo systemctl enable one-api
# sudo systemctl status one-api
[Unit]
-Description=One API Service
+Description=CZL Oapi Service
After=network.target
[Service]
diff --git a/web/public/favicon.ico b/web/public/favicon.ico
index c2c8de0c..385421c8 100644
Binary files a/web/public/favicon.ico and b/web/public/favicon.ico differ
diff --git a/web/public/index.html b/web/public/index.html
index b8e324d2..e721a79f 100644
--- a/web/public/index.html
+++ b/web/public/index.html
@@ -1,18 +1,26 @@
-
-
-
-
-
-
-
- One API
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ CZLOapi
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/public/logo.png b/web/public/logo.png
index 0f237a22..20633a2d 100644
Binary files a/web/public/logo.png and b/web/public/logo.png differ
diff --git a/web/src/components/ChannelsTable.js b/web/src/components/ChannelsTable.js
index 732189cb..b8ab597e 100644
--- a/web/src/components/ChannelsTable.js
+++ b/web/src/components/ChannelsTable.js
@@ -317,19 +317,6 @@ const ChannelsTable = () => {
onChange={handleKeywordChange}
/>
- {
- showPrompt && (
- {
- setShowPrompt(false);
- setPromptShown("channel-test");
- }}>
- 当前版本测试是通过按照 OpenAI API 格式使用 gpt-3.5-turbo
- 模型进行非流式请求实现的,因此测试报错并不一定代表通道不可用,该功能后续会修复。
-
- 另外,OpenAI 渠道已经不再支持通过 key 获取余额,因此余额显示为 0。对于支持的渠道类型,请点击余额进行刷新。
-
- )
- }