Giter Club home page Giter Club logo

openai-api-proxy-key-pool's Introduction

OpenAI API Proxy with Key Pool

openai-api-proxy-key-pool 是一个反向代理服务,用于代理 OpenAI API 的请求。同时,它还提供了轮询池 key 调用功能,使您能够在访问 OpenAI API 时轮询使用不同的 API 密钥。

功能

  • 反向代理 OpenAI API 请求
  • 轮询池 key 调用,实现对不同 API 密钥的轮询使用
  • 配置文件支持,方便管理 API 密钥

安装

方法 1:使用 Go 编译

  1. 克隆项目到本地:
git clone https://github.com/surenkid/openai-api-proxy-key-pool.git
  1. 进入项目目录:
cd openai-api-proxy-key-pool
  1. 使用 Go 编译项目(确保已安装 Go):
go build

方法 2:使用 Docker 部署

确保已安装 Docker

运行以下命令,将代理服务部署为 Docker 容器:

docker run -p 8124:8124 -v /home/volume/openai-api-proxy-key-pool/config.json:/config/config.json surenkid/openai-api-proxy-key-pool:latest

方法 3:使用 Docker Compose 部署

确保已安装 Docker Compose

  1. 在项目根目录创建一个名为 docker-compose.yml 的文件,并填充以下内容:
version: '3'

services:
  openai-api-proxy-key-pool:
    image: surenkid/openai-api-proxy-key-pool:latest
    ports:
      - "8124:8124"
    volumes:
      - ./config/config.json:/config/config.json
  1. 运行以下命令,使用 Docker Compose 启动代理服务:
docker-compose up

使用

  1. 更新 config/config.json 文件,添加您的 API 密钥。参考配置文件示例:
{
  "keys": {
    "ai-yourkey1": [
      "sk-openaikey1",
      "sk-openaikey2",
      "sk-openaikey3"
    ],
    "ai-yourkey2": [
      "sk-openaikey4"
    ]
  },
  "helicone": "sk-heliconekey",
  "baseurl": "https://api.openai.com"
}
  1. 如果使用 Go 编译方法,运行编译好的二进制文件:
./openai-api-proxy-key-pool

如果使用 Docker 部署或 Docker Compose 部署方法,容器已在上一步启动。

  1. 代理服务将在端口 8124 上启动,您可以将您的请求发送到 http://localhost:8124

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.