Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Dalufishe/freegptjs
Free ChatGPT 3.5 API for Javascript.
https://github.com/Dalufishe/freegptjs
Last synced: 14 days ago
JSON representation
Free ChatGPT 3.5 API for Javascript.
- Host: GitHub
- URL: https://github.com/Dalufishe/freegptjs
- Owner: Dalufishe
- Created: 2024-04-03T05:39:11.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-04-25T05:01:41.000Z (7 months ago)
- Last Synced: 2024-09-17T03:15:07.458Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/freegptjs
- Size: 5.86 KB
- Stars: 62
- Watchers: 2
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js Free GPT 3.5 API Library
This library provides Free access to the OpenAI ChatGPT 3.5 API from JavaScript.
> No API key required.
The API is almost the same as [openai-node](https://github.com/openai/openai-node/tree/master).
```bash
npm install freegptjs
```### Usage
```js
import FreeGPT3 from "freegptjs";// No API key required.
const openai = new FreeGPT3();async function main() {
const chatCompletion = await openai.chat.completions.create({
messages: [{ role: "user", content: "Hello, Free GPT !" }],
model: "gpt-3.5-turbo",
});
console.log(chatCompletion.choices[0].message.content);
}main();
```### Streaming responses
```js
import FreeGPT3 from "freegptjs";const openai = new FreeGPT3();
async function main() {
const stream = await openai.chat.completions.create({
model: "gpt-3.5-turbo",
messages: [{ role: "user", content: "Hello, Free GPT !" }],
stream: true,
});
for await (const chunk of stream) {
console.log(chunk.choices[0]?.delta?.content || "");
}
}main();
```### Special Thanks
https://github.com/skzhengkai/free-chatgpt-api
https://github.com/missuo/FreeGPT35