openai-node (openai/openai-node)

Searching Database…

What is this?This is the official TypeScript/JavaScript client library for the OpenAI REST API, auto-generated from OpenAI's OpenAPI specification, giving typed access to the Responses API, Chat Completions, Realtime API, and more.
Is this a standalone app or a library I import into my own project?It is a library/SDK: you install it as a dependency in a Node, Deno, or browser JS/TS project and call it from your own code, not a standalone application.
How do I install and start using it?Install it from npm (npm install openai) in a Node.js project; in Deno you can import the package directly from npm without a separate install step.
Do I need an OpenAI API key to use it?Yes, the client authenticates with an apiKey by default (or alternative workload identity credentials for Azure/GCP/Kubernetes); it also requires Node.js 22 or newer.
Does it work exactly the same with Azure OpenAI?No, you need to use the separate AzureOpenAI class, and because the Azure API shape differs slightly from the core API, the generated TypeScript types for some responses and params won't always be accurate.
Can I run this in a browser, or only in Node?It targets Node.js and Deno by default, but it also works in browser-compatible runtimes (e.g. for the Bedrock API-key entrypoint) once you explicitly enable the dangerouslyAllowBrowser option.
What is the Realtime API for?It lets you build low-latency, multi-modal conversational experiences with text and audio as input and output, plus function calling, over a WebSocket connection.
Can I use this SDK with Amazon Bedrock instead of calling OpenAI directly?Yes, you can configure the standard OpenAI client with a Bedrock provider to call Bedrock's OpenAI-compatible API, using either the AWS SigV4 credential chain or a Bedrock API key.
Does the library retry failed requests automatically?Yes, connection errors, 408/409/429 responses, and 5xx errors are retried twice by default with exponential backoff, and this is configurable via the maxRetries option.
How do I verify OpenAI webhook signatures?Use client.webhooks.unwrap() to verify and parse a webhook payload in one async call, or client.webhooks.verifySignature() to just check the signature; both throw if the signature is invalid.
Creator
openai
Size
27.3 MB
Stars
11.3K
Age
4y
Commits · 90 Days