OpenAI developer platform

Developer quickstart
Set up your environment and make your first API request in minutes
5 min
1
2
3
4
5
6
7
8
import OpenAI from "openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
    model: "gpt-4o",
    messages: [
        {"role": "user", "content": "write a haiku about ai"}
    ]
});