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 tasks
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 tasks
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 problems
Text input, text output
128k context length
Higher latency, uses tokens to think
Start building
Structured Outputs
Ensure model responses adhere to your supplied JSON schema
Realtime API
Build low-latency multimodal experiences
Assistants API
Build conversational assistants with tools and File Search
Async use cases
Batch requests for async, large-scale processing
Fine-tuning
Adapt a model to your specific use case with your data
Distillation
Evaluate and fine-tune models using production logs
Explore our guides
Prompt engineering
Get better results from LLMs
Production best practices
Transition from prototype to production
Safety best practices
Make sure your application is safe
Latency optimization
Improve latency across multiple use cases
Optimizing LLM accuracy
Maximize correctness and consistent behavior of LLMs