OpenAI API
The API for GPT-4o, GPT-4o-mini, and other OpenAI models. Chat completions, function calling, vision, audio (whisper/tts), embeddings, and fine-tuning. The most popular LLM API. Pay per token. Powers most AI apps.
Sam Altman, Elon Musk, Ilya Sutskever, Greg Brockman, et al. · Co-founded OpenAI in 2015
- Most AI apps needing a capable LLM.
- Function calling, vision, audio.
- When you want the most popular API.
- Prototyping quickly.
- When cost is critical (use cheaper models or local).
- Privacy-sensitive data (use local or self-hosted).
- When you need a specific non-OpenAI model.
Definition
The OpenAI API provides access to GPT-4o, GPT-4o-mini, o1 (reasoning), embeddings (text-embedding-3), Whisper (speech-to-text), TTS (text-to-speech), DALL-E (images), and fine-tuning. Chat completions with messages, function calling, vision, and structured output.
Why it exists
To provide access to state-of-the-art LLMs via a simple API, enabling developers to build AI apps without training models or managing infrastructure.
How it works
POST to api.openai.com with your API key. Messages array (system, user, assistant). Model parameter picks the model. Function calling for tool use. Streaming for real-time responses. Vision: send images. Embeddings: vector representations.
Scaling limits
Pay per token (can get expensive). Rate limits. API changes/deprecations. Data privacy (your data goes to OpenAI). Vendor lock-in to their API format.
Cost shape
Pay per token. GPT-4o-mini is cheap (~$0.15/1M input). GPT-4o is expensive (~$2.50/1M input). o1 is very expensive (~$15/1M).
Alternatives
- Anthropic (Claude) — Different model, similar API, sometimes better at coding.
- Google (Gemini) — Different model, integrated with Google Cloud.
- Ollama (local) — Free, private, lower quality.
Failure modes
- Cost.
- Rate limits.
- Data privacy.
- API changes.
- Vendor lock-in.
Related terms
LLM (Large Language Model), Function calling, Embedding, Anthropic (Claude API)