GithubHelp home page GithubHelp logo

chatgptproxyapi's Introduction

Demo

https://chatai.1rmb.tk

api

https://openai.1rmb.tk

1、利用Cloudflare Worker中转api.openai.com

  1. 新建一个 Cloudflare Worker
  2. 复制 cf_worker.js 里的代码粘贴到 Worker 中并部署
  3. 给 Worker 绑定一个没有被墙的域名
  4. 使用自己的域名代替 api.openai.com

详细教程

2、利用nextjs edge中转api.openai.com

利用Cloudflare pages部署

官方文档

  1. Fork本项目 点击Use this template按钮创建一个新的代码库。
  2. 登录到Cloudflare控制台.
  3. 在帐户主页中,选择pages> Create a project > Connect to Git
  4. 选择你 Fork 的项目存储库,在Set up builds and deployments部分中,选择Next.js作为您的框架预设。您的选择将提供以下信息。

一般默认即可

Configuration option Value
Production branch main
Framework preset next.js
Build command npx @cloudflare/next-on-pages --experimental-minify
Build directory .vercel/output/static

Environment variables (advanced)添加一个参数

Variable name Value
NODE_VERSION 16
  1. 点击Save and Deploy部署,然后点Continue to project即可看到访问域名

把官方接口的https://api.openai.com替换为https://xxx.pages.dev/api 即可 (https://xxx.pages.dev/api 为你的域名)

注意路径多了一个api

详细教程

docker 部署(要境外vps)

docker run -itd --name openaiproxy \
            -p 3000:3000 \
            --restart=always \
           gindex/openaiproxy:latest

使用

api : http://vpsip:3000/proxy/v1/chat/completions

curl --location 'http://vpsip:3000/proxy/v1/chat/completions' \
--header 'Authorization: Bearer sk-xxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
   "model": "gpt-3.5-turbo",
  "messages": [{"role": "user", "content": "Hello!"}]
 }'

Stargazers over time

Stargazers over time

chatgptproxyapi's People

Contributors

shuang54 avatar

Watchers

 avatar

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.