Giter Site home page Giter Site logo

chatgpt-api's Introduction

chatgpt-api

封装 OpenAI 网页版最新 ChatGPT 接口, 不需要使用 API Key, 完全免费

部署

需要 部署在海外服务器使用代理, 否则可能无法正常调用 OpenAI

方式一

docker run -d -p 3000:3000 zhuweiyou/chatgpt-api:latest

方式二

安装 nodejs 18.xpython 3.x 环境

pip3 install -r requirements.txt
npm install
npm start

文档

Base URL

http://127.0.0.1:3000

请求失败响应

{
    "message": "错误消息"
}

所有 API 都使用 POST 请求

/get_access_token 获取 token

  • email OpenAI 帐号 (不消耗免费额度, 也不需要花钱, 只用于登录获取 token)
  • password OpenAI 密码

响应

{
    "access_token": "xxx"
}

大概几个小时有效期, 建议开发者缓存至少 1 个小时以上, 而不是每次都调用获取

/send_message 向 ChatGPT 提问

  • access_token 在 /get_access_token 中获取的 access_token
  • prompt 提问内容
  • timeout 可选. 超时时间(毫秒), 默认无限等待
  • conversation_id 可选. 前一次 /send_message 的结果中返回, 用于上下文连续会话
  • parent_message_id 可选. 前一次 /send_message 的结果中返回, 用于上下文连续会话
  • prompt_prefix 可选. 默认为 'return the result in Chinese' 会让它尽量用中文回答
  • prompt_suffix 可选. 默认为 空
  • reverse_proxy 可选. 反向代理服务器, 用于绕过 cloudflare 人机验证, 默认内置

响应

{
    "text": "ChatGPT的回答",
    "conversation_id": "xxx",
    "parent_message_id": "yyy"
}

感谢

chatgpt-api's People

Contributors

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