openai/openai-node

Official JavaScript / TypeScript library for the OpenAI API

What it solves

This library provides a convenient, type-safe way for developers to interact with the OpenAI REST API using TypeScript or JavaScript, eliminating the need to manually construct HTTP requests.

How it works

It acts as a wrapper around the OpenAI REST API, generated from an OpenAPI specification. It provides high-level methods for interacting with various OpenAI models and features, including text generation, vision analysis, and real-time conversational experiences via WebSockets.

Who it’s for

Developers building applications with TypeScript or JavaScript (including Node.js and Deno) who want to integrate OpenAI's AI capabilities into their software.

Highlights

  • Multi-modal Support: Access to the Responses API for text and vision (image analysis) tasks.
  • Flexible Authentication: Supports API keys, workload identity authentication for cloud environments (Kubernetes, Azure, GCP), and X.509 client certificates.
  • Advanced Request Handling: Built-in support for streaming responses (SSE), automatic retries with exponential backoff, and auto-pagination for list methods.
  • Enterprise Integration: Native support for Microsoft Azure OpenAI and Amazon Bedrock's OpenAI-compatible API.
  • Developer Tooling: Includes helpers for file uploads (supporting various stream types), webhook verification for secure event handling, and detailed error handling with specific API error subclasses.

Related

  • Project
  • Project
  • Project
  • Project
  • Project