Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0892c1aa
authored
Apr 22, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README
parent
fcb6204a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
118 deletions
+17
-118
README.en.md
+0
-96
README.md
+17
-22
No files found.
README.en.md
deleted
100644 → 0
View file @
fcb6204a
<p
align=
"right"
>
<a
href=
"./README.md"
>
中文
</a>
|
<strong>
English
</strong>
</p>
<p
align=
"center"
>
<a
href=
"https://github.com/songquanpeng/one-api"
><img
src=
"https://raw.githubusercontent.com/songquanpeng/one-api/main/web/public/logo.png"
width=
"150"
height=
"150"
alt=
"one-api logo"
></a>
</p>
<div
align=
"center"
>
# Gin Template
_✨ Template for Gin & React projects ✨_
</div>
<p
align=
"center"
>
<a
href=
"https://raw.githubusercontent.com/songquanpeng/one-api/main/LICENSE"
>
<img
src=
"https://img.shields.io/github/license/songquanpeng/one-api?color=brightgreen"
alt=
"license"
>
</a>
<a
href=
"https://github.com/songquanpeng/one-api/releases/latest"
>
<img
src=
"https://img.shields.io/github/v/release/songquanpeng/one-api?color=brightgreen&include_prereleases"
alt=
"release"
>
</a>
<a
href=
"https://github.com/songquanpeng/one-api/releases/latest"
>
<img
src=
"https://img.shields.io/github/downloads/songquanpeng/one-api/total?color=brightgreen&include_prereleases"
alt=
"release"
>
</a>
<a
href=
"https://goreportcard.com/report/github.com/songquanpeng/go-file"
>
<img
src=
"https://goreportcard.com/badge/github.com/songquanpeng/one-api"
alt=
"GoReportCard"
>
</a>
</p>
<p
align=
"center"
>
<a
href=
"https://github.com/songquanpeng/one-api/releases"
>
Download
</a>
·
<a
href=
"https://github.com/songquanpeng/one-api/blob/main/README.en.md#deployment"
>
Tutorial
</a>
·
<a
href=
"https://github.com/songquanpeng/one-api/issues"
>
Feedback
</a>
·
<a
href=
"https://one-api.vercel.app/"
>
Demo
</a>
</p>
## Features
+
[
x
]
Built-in user management.
+
[
x
]
Built-in file management.
+
[
x
]
[
GitHub OAuth
]
(https://github.com/settings/applications/new).
+
[
x
]
WeChat official account authorization (need
[
wechat-server
](
https://github.com/songquanpeng/wechat-server
)
).
+
[
x
]
Email verification & password reset.
+
[
x
]
Request rate limiting.
+
[
x
]
Static files caching.
+
[
x
]
Mobile friendly UI.
+
[
x
]
Token based authorization.
+
[
x
]
Use GitHub Actions to build releases & Docker images.
+
[
x
]
Cloudflare Turnstile user validation.
## Deployment
### Manual deployment
1.
Download built binary from
[
GitHub Releases
](
https://github.com/songquanpeng/one-api/releases/latest
)
or build from source:
```shell
git clone https://github.com/songquanpeng/one-api.git
go mod download
go build -ldflags "-s -w" -o one-api
````
2. Run it:
```shell
chmod u+x one-api
./one-api --port 3000 --log-dir ./logs
```
3. Visit [http://localhost:3000/](http://localhost:3000/) and login. The username for the initial account is `
root
` and the password is `
123456
`.
### Deploy with Docker
Execute: `
docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api
`
Data will be saved in `
/home/ubuntu/data/one-api
`.
## Configurations
The system works out of the box.
You can configure the system by set environment variables or specify command line arguments.
After the system starts, use `
root
` user to log in to the system and do further configuration.
### Environment Variables
1. `
REDIS_CONN_STRING
`: when set, Redis will be used as the storage for request rate limitation instead of memory storage.
+ Example: `
REDIS_CONN_STRING=redis://default:redispw@localhost:49153
`
2. `
SESSION_SECRET
`: when set, a fixed session key will be used so that the logged-in users' cookie remains valid across system reboots.
+ Example: `
SESSION_SECRET=random_string
`
3. `
SQL_DSN
`: when set, the target SQL database will be used instead of SQLite.
+ Example: `
SQL_DSN=root:123456@tcp(localhost:3306)/one-api
`
### Command line Arguments
1. `
--port
<port
_number
>
`: specify the port number, the default value is `
3000
`.
+ Example: `
--port 3000
`
2. `
--log-dir
<log
_dir
>
`: specify the log dir, if not set, the log won't be saved.
+ Example: `
--log-dir ./logs
`
3. `
--version
`
: print the version and exit.
\ No newline at end of file
README.md
View file @
0892c1aa
<p
align=
"right"
>
<strong>
中文
</strong>
|
<a
href=
"./README.en.md"
>
English
</a>
</p>
<p
align=
"center"
>
<a
href=
"https://github.com/songquanpeng/one-api"
><img
src=
"https://raw.githubusercontent.com/songquanpeng/one-api/main/web/public/logo.png"
width=
"150"
height=
"150"
alt=
"one-api logo"
></a>
</p>
<div
align=
"center"
>
#
Gin
One API
# One API
_✨
用于 Gin & React 项目的模板
✨_
_✨
All in one 的 OpenAI 接口,整合各种 API 访问方式,开箱即用
✨_
</div>
...
...
@@ -40,19 +36,23 @@ _✨ 用于 Gin & React 项目的模板 ✨_
</p>
## 功能
+
[
x
]
内置用户管理
+
[
x
]
内置文件管理
+
[
x
]
[
GitHub 开放授权
]
(https://github.com/settings/applications/new)
+
[
x
]
微信公众号授权(需要
[
wechat-server
](
https://github.com/songquanpeng/wechat-server
)
)
+
[
x
]
邮箱验证以及通过邮件进行密码重置
+
[
x
]
请求频率限制
+
[
x
]
静态文件缓存
+
[
x
]
移动端适配
+
[
x
]
基于令牌的鉴权
+
[
x
]
使用 GitHub Actions 自动打包可执行文件与 Docker 镜像
+
[
x
]
Cloudflare Turnstile 用户校验
1.
多种 API 访问方式:
+
[
]
One API 服务端中继
+
[
]
[
API2D
]
(https://api2d.com/r/197971)
2.
聚合多种 API 访问方式,通过负载均衡的方式进行访问。
3.
单个访问渠道支持设置多个 API Key,利用起来你的多个 API Key。
4.
多种用户登录注册方式:
+
邮箱登录注册以及通过邮箱进行密码重置。
+
[
GitHub 开放授权
](
https://github.com/settings/applications/new
)
。
+
微信公众号授权(需要额外部署
[
WeChat Server
](
https://github.com/songquanpeng/wechat-server
)
)。
5.
支持用户管理。
## 部署
### 基于 Docker 进行部署
执行:
`docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api`
数据将会保存在宿主机的
`/home/ubuntu/data/one-api`
目录。
### 手动部署
1.
从
[
GitHub Releases
](
https://github.com/songquanpeng/one-api/releases/latest
)
下载可执行文件或者从源码编译:
```shell
...
...
@@ -69,11 +69,6 @@ _✨ 用于 Gin & React 项目的模板 ✨_
更加详细的部署教程[参见此处](https://iamazing.cn/page/how-to-deploy-a-website)。
### 基于 Docker 进行部署
执行:`
docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api
`
数据将会保存在宿主机的 `
/home/ubuntu/data/one-api
` 目录。
## 配置
系统本身开箱即用。
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment