Coder Social home page Coder Social logo

chatgpt-pawanosman's Introduction

正體中文 English

2023/03/24 更新

現在 API 更先進了!支援文字和聊天發送以及圖片產生(DALL-E),並新增與原始 API 相同的連接埠。

如果您有任何問題或需要協助,請加入 [Discord]

歡迎來到 ChatGPT API 免費反向代理

ChatGPT API Free Reverse Proxy 是一個免費的反向代理,可讓使用者免費訪問 OpenAI API。

目錄

功能

  • 多個 OpenAI 金鑰 - 可以設定多個 OpenAI 金鑰,該 API 會隨機選擇其中一個金鑰來使用。
  • 審核系統 - 這個 API 具有內建的審核系統,會在提示傳送到 OpenAI API 之前自動檢查它(以防止 OpenAI 因違反其政策而終止帳戶)。
  • 串流回應 - 這個 API 支援串流回應,透過串流回應,可以立即收到回應的部分內容,而不需等待整個回應完成後才傳回。
    當處理大量資料或即時資料流時,串流回應尤其有用。
    使用此功能,通常會設置回調函式來處理接收到的每個資料區段。
  • 官方相容 - 這個 API 使用與 OpenAI API 相同的連接埠,因此可以不用修改程式碼來存取 OpenAI API 函式庫。
  • 免費 - 可以免費使用我們提供的 API 反向代理,或使用自行託管的 API 反向代理

如何使用 ChatGPT API 反向代理

您可以選擇以下方法之一來使用 ChatGPT API 反向代理:

使用自已託管的 API 反向代理

要自行託管 ChatGPT API,請按照以下步驟:

  1. 建立 OpenAI API Key
  2. 複製此儲存庫並安裝相關的依賴套件:
git clone https://github.com/PawanOsman/ChatGPT.git
cd ChatGPT
npm install
  1. config.js 文件中設置您的 OpenAI 金鑰和其他配置。
  2. 啟動服務器:
npm start
  1. 通過向 API 連接埠發送 HTTP 請求來使用 API,例如:
http://localhost:3000/v1/completions
http://localhost:3000/v1/chat/completions

使用我們提供的 API 反向代理

要使用我們託管的 ChatGPT API,請按照以下步驟:

  1. 加入我們的 Discord 服務器。
  2. 通過在 #Bot 頻道中發送 /key 命令來獲取 API 金鑰,並將金鑰取代 pk-[OUR_API_KEY]
  3. 在您的請求中使用 API 金鑰,訪問以下連結。

文字發送:

https://api.pawan.krd/v1/completions
curl --location 'https://api.pawan.krd/v1/completions' \
--header 'Authorization: Bearer pk-***[OUR_API_KEY]***' \
--header 'Content-Type: application/json' \
--data '{
    "model": "text-davinci-003",
    "prompt": "Human: Hello\\nAI:",
    "temperature": 0.7,
    "max_tokens": 256,
    "stop": [
        "Human:",
        "AI:"
    ]
}'

curl --location "https://api.pawan.krd/v1/completions" ^
--header "Authorization: Bearer pk-***[OUR_API_KEY]***" ^
--header "Content-Type: application/json" ^
--data "{\"model\": \"text-davinci-003\", \"prompt\": \"Human: Hello\\nAI:\", \"temperature\": 0.7, \"max_tokens\": 256, \"stop\": [\"Human:\", \"AI:\"]}"

聊天室發送 (ChatGPT):

https://api.pawan.krd/v1/chat/completions
curl --location 'https://api.pawan.krd/v1/chat/completions' \
--header 'Authorization: Bearer pk-***[OUR_API_KEY]***' \
--header 'Content-Type: application/json' \
--data '{
    "model": "gpt-3.5-turbo",
    "max_tokens": 100,
    "messages": [
        {
            "role": "system",
            "content": "You are an helful assistant"
        },
        {
            "role": "user",
            "content": "Who are you?"
        }
    ]
}'

curl --location "https://api.pawan.krd/v1/chat/completions" ^
--header "Authorization: Bearer pk-***[OUR_API_KEY]***" ^
--header "Content-Type: application/json" ^
--data "{\"model\": \"gpt-3.5-turbo\", \"max_tokens\": 100, \"messages\": [{\"role\": \"system\",\"content\": \"You are an helful assistant\"},{\"role\": \"user\",\"content\": \"Who are you?\"}]}"

圖片產生 (DALL-E):

https://api.pawan.krd/v1/images/generations
curl --location 'https://api.pawan.krd/v1/images/generations' \
--header 'Authorization: Bearer pk-***[OUR_API_KEY]***' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "a photo of a happy corgi puppy sitting and facing forward, studio light, longshot",
    "n": 1,
    "size": "1024x1024"
}'

curl --location "https://api.pawan.krd/v1/images/generations" ^
--header "Authorization: Bearer pk-***[OUR_API_KEY]***" ^
--header "Content-Type: application/json" ^
--data "{\"prompt\": \"a photo of a happy corgi puppy sitting and facing forward, studio light, longshot\",\"n\": 1,\"size\": \"1024x1024\"}"

授權協議

MIT 授權證書

chatgpt-pawanosman's People

Contributors

rookie-rebot avatar pawanosman avatar 0954011723 avatar

Stargazers

kumayeh 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.