{
 "kind": "tool",
 "slug": "openai-npm",
 "path": "tools/openai-npm/",
 "name": "OpenAI",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Model SDKs",
   "tools/ai-sdks/"
  ]
 ],
 "lead": "Official TypeScript SDK for accessing OpenAI APIs including GPT and embeddings.",
 "chips": [
  {
   "label": "Model SDKs",
   "path": "tools/ai-sdks/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install openai"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/openai/openai-node"
  },
  {
   "label": "Website",
   "href": "https://github.com/openai/openai-node#readme"
  },
  {
   "label": "API page",
   "path": "apis/openai-api/"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "Apache-2.0",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/openai/openai-node"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 23, 2026",
   "note": "Latest GitHub release Nov 23, 2026. ",
   "src": "https://github.com/openai/openai-node"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "286 projects",
   "status": "info",
   "sub": "#1 of 92 in its category",
   "note": "Dependency in 286 public GitHub projects set up for AI coding agents that we scanned (4.6%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Official agent skills",
   "status": "yes",
   "sub": "1 from the makers",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://platform.openai.com/docs/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What OpenAI does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "OpenAI popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "81",
       "of": "/ 100",
       "l": "Gid Score, #84 overall"
      },
      {
       "n": "62.5M",
       "l": "downloads a week, npm"
      },
      {
       "n": "11.3K",
       "l": "GitHub stars"
      },
      {
       "n": "286",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How OpenAI is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "151 projects, 4.6%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "144 projects, 5.9%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "107 projects, 3.5%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "29 projects, 10.4%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "27 projects, 8.1%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "24 projects, 5.1%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "10 projects, 2.1%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "9 projects, 14.3%",
       "v": "Continue",
       "path": "agents/continue/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 58.0% of its projects",
       "v": "dotenv",
       "path": "tools/dotenv/"
      },
      {
       "l": "In 60.8% of its projects",
       "v": "Zod",
       "path": "tools/zod/"
      },
      {
       "l": "In 88.8% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 45.8% of its projects",
       "v": "tsx",
       "path": "tools/tsx/"
      },
      {
       "l": "In 65.4% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 31.1% of its projects",
       "v": "Express",
       "path": "tools/express/"
      },
      {
       "l": "In 49.7% of its projects",
       "v": "Lucide React",
       "path": "tools/lucide-react/"
      },
      {
       "l": "In 30.8% of its projects",
       "v": "Anthropic SDK",
       "path": "tools/anthropic-ai/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "OpenAI in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Retries with backoff are on by default",
       "v": "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."
      },
      {
       "l": "One error class per HTTP status",
       "v": "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."
      },
      {
       "l": "Request IDs on object responses",
       "v": "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."
      },
      {
       "l": "Workload identity instead of API keys",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Hand-built conversation history can break",
       "v": "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."
      },
      {
       "l": "10-minute default timeout, and timeouts retry",
       "v": "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."
      },
      {
       "l": "X.509 auth is Node-only with one endpoint",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Generate text with the Responses API"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Ts",
       "code": "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.responses.create({\n  model: 'gpt-5.5',\n  instructions: 'You are a coding assistant that talks like a pirate',\n  input: 'Are semicolons optional in JavaScript?',\n});\n\nconsole.log(response.output_text);"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about OpenAI",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Agent Skills for it",
       "path": "skills/",
       "items": [
        ": 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"
       ]
      },
      {
       "title": "Head to head",
       "items": [
        {
         "text": "OpenAI vs Anthropic SDK",
         "note": "used together in 88 projects",
         "path": "tools/compare/openai-vs-anthropic-sdk/"
        },
        {
         "text": "OpenAI vs Google Generative AI",
         "note": "used together in 51 projects",
         "path": "tools/compare/openai-vs-google-generative-ai/"
        }
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "dotenv: Env file loader",
        "zod: Schema validation",
        "typescript: Typed JavaScript",
        "next: React framework",
        "tailwindcss: Utility CSS",
        "lucide-react: Icon components"
       ]
      },
      {
       "title": "More in Model SDKs",
       "path": "tools/ai-sdks/",
       "items": [
        {
         "text": "AI SDK",
         "path": "tools/ai/"
        },
        {
         "text": "OpenAI Python Library",
         "path": "tools/openai-pypi/"
        },
        {
         "text": "Anthropic Python SDK",
         "path": "tools/anthropic/"
        },
        {
         "text": "Google GenAI Python SDK",
         "path": "tools/google-genai-pypi/"
        },
        {
         "text": "Hugging Face Hub",
         "path": "tools/huggingface-hub/"
        },
        {
         "text": "LiteLLM",
         "path": "tools/litellm/"
        },
        {
         "text": "Ollama",
         "path": "tools/ollama-pypi/"
        },
        {
         "text": "Transformers.js",
         "path": "tools/huggingface/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "OpenAI",
       "me": true,
       "facts": [
        "Apache-2.0",
        "Gid 81",
        "62.5M/wk"
       ]
      },
      {
       "name": "Anthropic SDK",
       "why": "Official TypeScript SDK for calling Claude API and building agent applications.",
       "path": "tools/anthropic-ai/",
       "facts": [
        "Apache-2.0",
        "Gid 74",
        "75M/wk"
       ]
      },
      {
       "name": "Google Generative AI",
       "why": "Official SDK for Google Gemini API to build AI-powered applications.",
       "path": "tools/google-genai-npm/",
       "facts": [
        "Apache-2.0",
        "Gid 69",
        "34.2M/wk"
       ]
      },
      {
       "name": "Ollama JavaScript Library",
       "why": "Official JavaScript client library for Ollama to run and interact with local language models.",
       "path": "tools/ollama-npm/",
       "facts": [
        "MIT",
        "Gid 57",
        "1.3M/wk"
       ]
      },
      {
       "name": "Groq SDK",
       "why": "Official TypeScript SDK for calling Groq's fast language models API.",
       "path": "tools/groq-sdk/",
       "facts": [
        "Apache-2.0",
        "Gid 47",
        "1.2M/wk"
       ]
      },
      {
       "name": "Mistral AI",
       "why": "Official TypeScript SDK for calling Mistral's language models and APIs.",
       "path": "tools/mistralai-mistralai/",
       "facts": [
        "Apache-2.0",
        "Gid 45",
        "6.7M/wk"
       ]
      },
      {
       "name": "Replicate",
       "why": "JavaScript client library for calling Replicate's AI model API.",
       "path": "tools/replicate-npm/",
       "facts": [
        "Apache-2.0",
        "Gid 41",
        "713K/wk"
       ]
      }
     ],
     "more": "Compare OpenAI with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install openai"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## OpenAI (openai)\n- Use the Responses API (`client.responses.create`) for new code. The README calls Chat Completions the previous standard, which is still supported indefinitely.\n- The client reads `OPENAI_API_KEY` by default, so `apiKey` can be omitted. `workloadIdentity` and `apiKey` are mutually exclusive, so pass only one.\n- When replaying conversation history by hand, pass the output through `toResponseInputItems()` instead of filtering it to messages. For simple continuation, use `previous_response_id`.\n- In webhook handlers, pass the raw request text (not parsed JSON) to `client.webhooks.unwrap()` or `verifySignature()`, and `await` it before trusting the event.\n- Catch `OpenAI.APIError` and branch on subclasses such as `RateLimitError`. Log `err.requestID`, or `response._request_id` on successful object responses.\n- Retries (2 by default) and the timeout (10 minutes by default) are set with `maxRetries` and `timeout`, on the client or per request.\n- Use `toStreamingFile()` instead of `toFile()` when uploading a stream, because `toFile()` buffers stream inputs.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm openai"
  ],
  [
   "Category",
   "Model SDKs"
  ],
  [
   "License",
   "Apache-2.0"
  ],
  [
   "Latest version",
   "v7.32.0, October 9, 2026"
  ],
  [
   "On GitHub since",
   "December 2021"
  ],
  [
   "Gid Score",
   "80.8"
  ],
  [
   "Rank in category",
   "#1 of 92"
  ],
  [
   "GitHub",
   "openai/openai-node"
  ],
  [
   "Last change",
   "Nov 23, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/openai.png"
}