mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-17 01:06:37 +08:00
OpenAI 接口管理 & 分发系统,支持 Azure、Anthropic Claude、Google PaLM 2 & Gemini、智谱 ChatGLM、百度文心一言、讯飞星火认知、阿里通义千问、360 智脑以及腾讯混元,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用. OpenAI key management & redistribution system, using a single API for all LLMs, and features an English UI.
.github/workflows | ||
common | ||
controller | ||
middleware | ||
model | ||
router | ||
web | ||
.gitignore | ||
Dockerfile | ||
go.mod | ||
go.sum | ||
LICENSE | ||
main.go | ||
README.en.md | ||
README.md |
中文 | English
Gin Template
✨ Template for Gin & React projects ✨
Download · Tutorial · Feedback · Demo
Features
- Built-in user management.
- Built-in file management.
- GitHub OAuth.
- WeChat official account authorization (need wechat-server).
- Email verification & password reset.
- Request rate limiting.
- Static files caching.
- Mobile friendly UI.
- Token based authorization.
- Use GitHub Actions to build releases & Docker images.
- Cloudflare Turnstile user validation.
Deployment
Manual deployment
- Download built binary from GitHub Releases or build from source:
git clone https://github.com/songquanpeng/gin-template.git go mod download go build -ldflags "-s -w" -o gin-template
- Run it:
chmod u+x gin-template ./gin-template --port 3000 --log-dir ./logs
- Visit http://localhost:3000/ and login. The username for the initial account is
root
and the password is123456
.
Deploy with Docker
Execute: docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/gin-template:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/gin-template
Data will be saved in /home/ubuntu/data/gin-template
.
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
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
- Example:
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
- Example:
SQL_DSN
: when set, the target SQL database will be used instead of SQLite.- Example:
SQL_DSN=root:123456@tcp(localhost:3306)/gin-template
- Example:
Command line Arguments
--port <port_number>
: specify the port number, the default value is3000
.- Example:
--port 3000
- Example:
--log-dir <log_dir>
: specify the log dir, if not set, the log won't be saved.- Example:
--log-dir ./logs
- Example:
--version
: print the version and exit.