Giter Club home page Giter Club logo

chatgpt-api-test's Introduction

2024 Node.js 调用 ChatGPT API 实现 Stream 流式效果

运行效果如下

ChatGPT API 文档 https://platform.openai.com/docs/overview

背景

  • 网上很多资料过时了,不再符合 OpenAI 的开发文档
  • 我要做一个 Node 全栈 AIGC 知识库项目 划水 AI (仿 notion),需要用到 ChatGPT API

前置条件

  • 有一个可以访问 ChatGPT API 的机器
  • 有 ChatGPT 账号,且开通了 API key 并且可以被调用(配额充足)

下载和运行

保证你的机器上有 git 和 nodejs

git clone 这份代码

代码根目录,将 .env.example 文件重命名为 .env ,然后修改内容, 写上你自己的 API key

控制台进入代码目录,执行

npm install
npm start

测试

访问该机器 3001 端口。PS:云服务器可能需要开通 OS 防火墙端口,以及平台的安全组。

关于我的 Node 全栈 AIGC 项目

我将用 Next.js + ChatGPT 开发一个 AIGC 知识库(仿 Notion AI 和协同编辑)划水 AI 项目(尚未开发,但域名 证书 服务器已经搞定),并真实上线运行。项目介绍看这里

如果你也对 Node 全栈 AIGC 感兴趣,可以来围观、学习甚至参与开发,可以私信我。

chatgpt-api-test's People

Contributors

amaler avatar wangfupeng1988 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.