openai-node

Official JavaScript / TypeScript library for the OpenAI API

What is openai-node?

Official JavaScript / TypeScript library for the OpenAI API

Overview of openai-node

What it is

This is the official JavaScript / TypeScript library for the OpenAI API. It provides convenient access to the OpenAI REST API from TypeScript or JavaScript. The library is generated from the OpenAI OpenAPI specification.

Key features

  • Provides access to the OpenAI Responses API and Chat Completions API for generating text from models.
  • Supports multi-turn conversations with a toResponseInputItems() helper to normalize replayable output items.
  • Includes vision capabilities to analyze images and generate text about visual content using the Responses API.
  • Supports workload identity authentication for secure, automated environments like Kubernetes, Azure, and GCP, using short-lived tokens instead of long-lived API keys.
  • Supports X.509 client certificate authentication for workload identity in Node.js.
  • Provides streaming responses using Server-Sent Events (SSE).
  • Supports file uploads in various forms, including File, fetch Response, fs.ReadStream, and the toFile or toStreamingFile helpers.

Use cases

  • Building applications that generate text using OpenAI models, such as chatbots or coding assistants.
  • Analyzing images and generating descriptions or answers about visual content.
  • Managing conversation history in multi-turn interactions with the Responses API.
  • Integrating with cloud environments that use workload identity for authentication, such as Kubernetes, Azure, and GCP.
  • Streaming real-time responses from the model for interactive applications.
  • Uploading files for purposes like fine-tuning models.

Getting started

shnpm install openai

License and pricing

The license is Apache-2.0. The pricing type is open source.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/openaiopenai-node.svg)](https://yunodb.com/tools/openaiopenai-node?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/openaiopenai-node?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/openaiopenai-node.svg" alt="Featured on YunoDB" height="20"></a>