V4 TypeScript / Node SDK for OpenAI API

We’re excited to announce a major new version of our TypeScript/Node SDK for the OpenAI API!

Version 4 offers a huge set of improvements – some of the highlights include:

  • Streaming responses for chat & completions
  • Carefully crafted TypeScript types
  • Support for ESM, Vercel edge functions, Cloudflare workers, Deno
  • Better file upload API for Whisper, fine-tune files, DALL·E images
  • Improved error handling through automatic retries & error classes
  • Increased performance via TCP connection reuse
  • Simpler initialization logic

If you’ve used a previous version of our SDK, check out the migration guide.

Otherwise, you can get started today by running npm i openai

NPM: openai - npm

Github: GitHub - openai/openai-node: Node.js library for the OpenAI API

23 Likes

That’s Great thanks for sharing @logankilpatrick

1 Like

Just realised that… 1,5 months later… no emails nor nothing to the consumers… Not very developer friendly…

Secondly, most of the API references are not updated, the examples are as minimum as possible… would really help if we could get more solid examples… with proper error handlings, (addressing no funds, busy server etc errors)… and especially, how to address streaming… the example provided is not acceptable…

I am paying every month for the service, quite a lot… and would expect the support and documentation to be at least decent!

Could you please provide the example in streaming… what would be a good practice to make a production ready API proxy… with the ability to ABORT (terminate the generation) at any time, like in chatGPT?

I don’t think is too much to ask

1 Like

You can always star the Github repository or fork and pull from upstream.

https://github.com/openai/openai-node