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"}
    ]
});

Meet the models

GPT-4o

Our high-intelligence flagship model for complex, multi‑step taskssource

Text and image input, text output
128k context length
Smarter model, higher price per token
GPT-4o mini

Our affordable and intelligent small model for fast, lightweight taskssource

Text and image input, text output
128k context length
Faster model, lower price per token
o1-preview & o1-mini
Beta

A new series of reasoning models for solving hard problemssource

Text input, text output
128k context length
Higher latency, uses tokens to think