Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

OpenAI

Official TypeScript SDK for accessing OpenAI APIs including GPT and embeddings.

Model SDKsNPM

GitHubWebsiteAPI page

1. License

License from npm.

github.com/openai/openai-node

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What OpenAI does

This is OpenAI's own TypeScript/JavaScript client, generated from the API's OpenAPI spec. Beyond model calls it ships retries, per-status error classes, webhook signature checks, and auth with short-lived tokens from cloud identity providers.

OpenAI popularity

81 / 100
Gid Score, #84 overall
62.5M
downloads a week, npm
11.3K
GitHub stars
286
agent projects use it
OpenAI: downloads per weeknpm, openai 62,533,826
OpenAI: GitHub starsopenai/openai-node 11,276

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How OpenAI is used

  • OpenAI is a dependency in 286 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (5.9% of the 4,867 JavaScript/TypeScript ones), #1 of 92 in model sdks.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,397; those are left out of every share on this page.
  • The most used alternative in our scan is Anthropic SDK (238 projects).
  • Projects that use it most often also use dotenv (58.0%), Zod (60.8%), TypeScript (88.8%).
  • It is more common in projects set up for Continue (14.3%) than for OpenAI Codex (2.1%).

By coding agent

151 projects, 4.6%
144 projects, 5.9%
107 projects, 3.5%
29 projects, 10.4%
27 projects, 8.1%
24 projects, 5.1%
10 projects, 2.1%
9 projects, 14.3%

Often used with

In 58.0% of its projects
In 60.8% of its projects
In 88.8% of its projects
In 45.8% of its projects
In 65.4% of its projects
In 31.1% of its projects
In 49.7% of its projects
In 30.8% of its projects

OpenAI in practice

Strengths

Retries with backoff are on by default

Connection errors, 408, 409, 429 and 5xx responses are retried twice with a short exponential backoff. The <code>maxRetries</code> option configures or disables this, either on the client or on a single request.

One error class per HTTP status

Failures throw subclasses of <code>APIError</code>, such as <code>RateLimitError</code> for 429 and <code>AuthenticationError</code> for 401. The README's example reads <code>requestID</code>, <code>status</code> and <code>headers</code> from the caught error.

Request IDs on object responses

Object responses carry a <code>_request_id</code> property taken from the <code>x-request-id</code> header. For streams, <code>.withResponse()</code> returns the ID next to the data.

Workload identity instead of API keys

The client accepts a <code>workloadIdentity</code> option, which is mutually exclusive with <code>apiKey</code>. The SDK ships token providers for Kubernetes service accounts, Azure managed identity and GCP. You can also supply your own JWT provider.

Watch out for

Hand-built conversation history can break

If you keep only the message items from <code>response.output</code>, you can drop reasoning or tool-call items, and the next request may fail. The README points to <code>toResponseInputItems()</code>, or to <code>previous_response_id</code> for simple continuation.

10-minute default timeout, and timeouts retry

By default a request times out after 10 minutes, and you can change this with the <code>timeout</code> option. The README notes that timed-out requests are also retried twice by default.

X.509 auth is Node-only with one endpoint

Certificate-based workload identity needs the optional <code>undici</code> peer. It currently supports only the global <code>https://mtls.api.openai.com/v1</code> endpoint.

Generate text with the Responses API

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const response = await client.responses.create({
  model: 'gpt-5.5',
  instructions: 'You are a coding assistant that talks like a pirate',
  input: 'Are semicolons optional in JavaScript?',
});

console.log(response.output_text);

More about OpenAI

Agent Skills for it
  • : Skills Catalog for Codex
  • openai-docs: Use when the user asks how to build with OpenAI products or APIs and needs up-to-date official documentation with citations (for example: Co
  • openai-tts: OpenAI Text-to-Speech API for high-quality speech synthesis. Use for generating natural-sounding audio from text with customizable voices an
  • openai: Check OpenAI API access and list the models your key can use. Read-only. Trigger phrases: openai, openai models, what models do I have acces
  • openai-frontend-design: This skill should be used when the user asks for "visual concepts", "image-led website design", or "concept fidelity". Create visual concept

See all

Head to head
Packages around it
  • dotenv: Env file loader
  • zod: Schema validation
  • typescript: Typed JavaScript
  • next: React framework
  • tailwindcss: Utility CSS
  • lucide-react: Icon components
More in Model SDKs

Alternatives

OpenAI This page

Apache-2.0Gid 8162.5M/wk

Anthropic SDK

Official TypeScript SDK for calling Claude API and building agent applications.

Apache-2.0Gid 7475M/wk

Google Generative AI

Official SDK for Google Gemini API to build AI-powered applications.

Apache-2.0Gid 6934.2M/wk

Ollama JavaScript Library

Official JavaScript client library for Ollama to run and interact with local language models.

MITGid 571.3M/wk

Groq SDK

Official TypeScript SDK for calling Groq's fast language models API.

Apache-2.0Gid 471.2M/wk

Mistral AI

Official TypeScript SDK for calling Mistral's language models and APIs.

Apache-2.0Gid 456.7M/wk

Replicate

JavaScript client library for calling Replicate's AI model API.

Apache-2.0Gid 41713K/wk

Compare OpenAI with another tool

Get started

Install it.

npm install openai

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## OpenAI (openai)
- Use the Responses API (`client.responses.create`) for new code. The README calls Chat Completions the previous standard, which is still supported indefinitely.
- The client reads `OPENAI_API_KEY` by default, so `apiKey` can be omitted. `workloadIdentity` and `apiKey` are mutually exclusive, so pass only one.
- When replaying conversation history by hand, pass the output through `toResponseInputItems()` instead of filtering it to messages. For simple continuation, use `previous_response_id`.
- In webhook handlers, pass the raw request text (not parsed JSON) to `client.webhooks.unwrap()` or `verifySignature()`, and `await` it before trusting the event.
- Catch `OpenAI.APIError` and branch on subclasses such as `RateLimitError`. Log `err.requestID`, or `response._request_id` on successful object responses.
- Retries (2 by default) and the timeout (10 minutes by default) are set with `maxRetries` and `timeout`, on the client or per request.
- Use `toStreamingFile()` instead of `toFile()` when uploading a stream, because `toFile()` buffers stream inputs.