The OpenAI SDK
The OpenAI API is a normal HTTPS API with an official Node package. The client reads your key from the OPENAI_API_KEY environment variable.
Last updated
Analogy
Like the Stripe SDK: a typed wrapper around fetch, so you write client.chat.completions.create() instead of hand-building POST requests.
Code example
// npm i openai zod dotenv// .env -> OPENAI_API_KEY=sk-...import OpenAI from "openai"; const client = new OpenAI(); // reads OPENAI_API_KEYIn an agent
Every framework you'll meet later (LangChain, LangGraph, the Vercel AI SDK) is a wrapper around these same calls. Learn them raw first.
Questions people ask
How do I set up the OpenAI SDK in Node?
Run npm i openai, put your key in a .env file as OPENAI_API_KEY, and create a client with new OpenAI(). The client reads the key from the environment, so it never appears in your code. Keep this on the server: a key shipped to the browser can be copied and spent by anyone.
Should I learn the raw OpenAI SDK before LangChain or the Vercel AI SDK?
Yes. Those frameworks wrap the same chat completion and tool calling requests. If you have made the raw calls yourself, you know what the framework is doing for you, you can debug it when something breaks, and you can answer the interview question about what the abstraction hides.