Looking for the library? Click here!
OpenAI's GPT Chat Completion API allows you to generate conversational text from a prompt just like the ChatGPT Plus subscription. The difference between ChatGPT Plus and the this API is mainly the price. At the time of writing, ChatGPT Plus is a flat US$20 per month, while its API counterpart is US$0.002 per 1K tokens (for the gpt-3.5-turbo
model). This means that if you don't plan on using more than 10M tokens per month, you could potentially save money by using the Chat Completion API instead of the ChatGPT Plus subscription. If you're not a developer, you can use the GPT Turbo Web App to interact with these paid models. You'll still need to create an OpenAI account with a credit card to get an API key.
This monorepo contains an isomorphic library and implementations of it in different JavaScript environments. If you're developing a product and want to use GPT Turbo, you'll probably want to check out the library package.
Implementations and the library are provided as-is. I am not responsible for any accidental, incidental, special, consequential, or exemplary damages, including without limitation, damages for loss of profits, goodwill, use, data or other intangible losses, resulting from the use of the implementations or the library. Use at your own risk. Set limits on OpenAI's billing page to avoid unexpected charges.
- Interact with any of OpenAI's Chat Completion models, including GPT-4, if you have access to it.
- Full list of models here
- Keeps track of message history sent to OpenAI's API to enable conversation continuation.
- Easily access the estimated cost of your conversations before sending them to OpenAI's API.
- Easily access the estimated cost of the cumulative usage of your conversation as it progresses.
- Built entirely with TypeScript
Since Chat Completion models are paid, you'll need an OpenAI API key and setup billing information. Make sure to set a usage limit to avoid unexpected charges.
Since this a JavaScript monorepo, you'll need to have Node.js installed.
Most implementations were made following this guide: OpenAI Docs: Chat completion. Check out each of their respective folder for more information on how to use them.
- Library: An isomorphic JavaScript library that allows you to interact with the Chat Completion API.
- CLI: A command-line interface for interacting with the library. (Built with React!)
- Web: A web app, similar to ChatGPT, for interacting with the library.
- Nest: A NestJS backend, for interacting with the library via a REST API.
This monorepo uses Lerna to manage different implementations. Since every implementation rely on the Library, it's a good idea to watch for changes in the Library and automatically build it when changes are detected. To do so, run the following command in the root of the project (here):
npm run dev
This will watch for changes in the Library and automatically build it when changes are detected, making it available to the other implementations.