Brak opisu

JustSong b86e1dec64 Fix "HTTP decompression failed" 2 lat temu
.github 539eac217f Rename to One API 2 lat temu
common b86e1dec64 Fix "HTTP decompression failed" 2 lat temu
controller b86e1dec64 Fix "HTTP decompression failed" 2 lat temu
middleware 852af57c03 Relay done but not working 2 lat temu
model 852af57c03 Relay done but not working 2 lat temu
router 852af57c03 Relay done but not working 2 lat temu
web 279ae8ad50 Bug fix 2 lat temu
.gitignore ab1f8a2bf4 Initial commit 2 lat temu
Dockerfile 539eac217f Rename to One API 2 lat temu
LICENSE ab1f8a2bf4 Initial commit 2 lat temu
README.md c30b069f2e Update README 2 lat temu
go.mod 539eac217f Rename to One API 2 lat temu
go.sum ab1f8a2bf4 Initial commit 2 lat temu
main.go 5e8c22fbf6 Update system log 2 lat temu

README.md

one-api logo

# One API _✨ All in one 的 OpenAI 接口,整合各种 API 访问方式,开箱即用✨_

license release release GoReportCard

程序下载 · 部署教程 · 意见反馈 · 在线演示

功能

  1. 支持多种 API 访问渠道,欢迎 PR 或提 issue 添加更多渠道:
  2. 支持通过负载均衡的方式访问多个渠道,访问失败自动切换。
  3. 支持单个访问渠道设置多个 API Key,利用起来你的多个 API Key。
  4. 支持 HTTP SSE
  5. 多种用户登录注册方式:
  6. 支持用户管理。

部署

基于 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 下载可执行文件或者从源码编译: shell git clone https://github.com/songquanpeng/one-api.git go mod download go build -ldflags "-s -w" -o one-api 2. 运行: shell chmod u+x one-api ./one-api --port 3000 --log-dir ./logs 3. 访问 [http://localhost:3000/](http://localhost:3000/) 并登录。初始账号用户名为root,密码为123456。 更加详细的部署教程[参见此处](https://iamazing.cn/page/how-to-deploy-a-website)。 ## 配置 系统本身开箱即用。 你可以通过设置环境变量或者命令行参数进行配置。 等到系统启动后,使用root用户登录系统并做进一步的配置。 ### 环境变量 1.REDIS_CONN_STRING:设置之后将使用 Redis 作为请求频率限制的存储,而非使用内存存储。 + 例子:REDIS_CONN_STRING=redis://default:redispw@localhost:49153 2.SESSION_SECRET:设置之后将使用固定的会话密钥,这样系统重新启动后已登录用户的 cookie 将依旧有效。 + 例子:SESSION_SECRET=random_string 3.SQL_DSN:设置之后将使用指定数据库而非 SQLite。 + 例子:SQL_DSN=root:123456@tcp(localhost:3306)/one-api ### 命令行参数 1.--port : 指定服务器监听的端口号,默认为3000。 + 例子:--port 3000 2.--log-dir : 指定日志文件夹,如果没有设置,日志将不会被保存。 + 例子:--log-dir ./logs 3.--version`: 打印系统版本号并退出。