The OpenAI API provides programmatic access to state-of-the-art language models (GPT-5.5, GPT-5.4, GPT-5.2, o3, o4-mini), image generation (gpt-image-2, gpt-image-1.5), speech-to-text (gpt-4o-transcribe), text-to-speech, embeddings, and video generation. The 2025β2026 landscape is dominated by the Responses API as the primary interface for agentic workflows, with built-in tools for web search, code interpreter, file search, computer use, hosted shell, skills, and Model Context Protocol (MCP) integrations. Key 2026 additions include GPT-5.5 (flagship, April 2026), the GPT-5.4 family (March 2026), gpt-image-2 (April 2026), Realtime 2 with speech translation (May 2026), and Compaction for long-running agent contexts. β οΈ Fine-tuning is being wound down (new users blocked May 2026; existing users until Jan 2027), and the Assistants API sunsets August 26, 2026 β migrate to the Responses API and Conversations API before those dates.
What This Cheat Sheet Covers
This topic spans 18 focused tables and 184 indexed concepts, 102 flashcards, 6 practice tests with 218 questions. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Core API Endpoints
The Responses API is OpenAI's primary interface for building agents and complex workflows, while Chat Completions remains supported for simple stateless apps. Picking the right endpoint, and knowing the capabilities each one unlocks, is the first decision in any integration.
| Endpoint | Example | Description | |
|---|---|---|---|
client.responses.create(model="gpt-5.5", input=[...]) | β’ Primary interface for stateful agentic conversations β’ built-in tools: web_search, file_search, code_interpreter, computer_use, hosted_shell, skills, apply_patch β’ supports MCP, Compaction, Conversations API, WebSocket mode β’ supersedes Assistants API (deprecated Aug 26, 2025; sunset Aug 26, 2026). | ||
client.chat.completions.create(model="gpt-5.5", messages=[...]) | β’ Stateless endpoint for conversational AI β’ pass message history explicitly each request β’ supports JSON mode, vision, function calling, streaming β’ still supported for simple stateless apps; Responses is recommended for all new projects and gives reasoning models better performance. | ||
client.conversations.create(); client.responses.create(..., conversation="conv_...") | β’ Persists long-running stateful conversations as a durable object within the Responses API β’ OpenAI handles thread state server-side β’ stores items (messages, tool calls, tool outputs); replaces Assistants Threads β’ released August 2025. | ||
client.embeddings.create(model="text-embedding-3-small", input="text") | β’ Converts text to dense vector representations for semantic search, clustering, RAG β’ returns 1536-dim (small) or 3072-dim (large) vectors by default β’ supports dimensions param for vector compression. | ||
client.audio.transcriptions.create(model="gpt-4o-transcribe", file=audio) | β’ Transcribes audio to text β’ gpt-4o-transcribe (higher accuracy) or gpt-4o-mini-transcribe (fast, low cost) β’ model trained on 98 languages, handles background noise and diverse accents β’ translations endpoint transcribes non-English audio into English (whisper-1). | ||
client.audio.speech.create(model="gpt-4o-mini-tts", voice="coral", input="text") | β’ Generates spoken audio from text β’ gpt-4o-mini-tts (steerable style/emotion via instructions) or tts-1/tts-1-hd (legacy)β’ 13 built-in voices (e.g. alloy, coral, marin, cedar), optimized for English β’ formats: MP3, Opus, AAC, FLAC, WAV, PCM. | ||
client.images.generate(model="gpt-image-2", prompt="a sunset", size="1024x1024") | β’ gpt-image-2 (current): state-of-the-art GPT Image model β’ generations (from a text prompt) and edits (modify an existing image, incl. mask-based inpainting) β’ also usable as a built-in tool in the Responses API for multi-turn editing. | ||
client.batches.create(input_file_id="file-xyz", endpoint="/v1/responses") | β’ Asynchronous processing for large-scale workloads (up to 50K requests per batch, 200 MB file) β’ 50% cost reduction vs synchronous APIs, separate higher rate-limit pool β’ completes within 24 hours; supports /v1/responses, /v1/chat/completions, /v1/embeddings, /v1/moderations, /v1/images/generations, /v1/videos. | ||
client.moderations.create(model="omni-moderation-latest", input="user content") | β’ Detects harmful content across 13 categories (text + image) β’ free to use β’ omni-moderation-latest supports multimodal (text and image) inputsβ’ image files up to 20 MB; can also run inline alongside a generated response. | ||
wss://api.openai.com/v1/realtime?model=gpt-realtime-2.1 | β’ Bidirectional audio streaming via WebSocket (server-to-server) or WebRTC (browser/mobile) β’ gpt-realtime-2.1 (current): low-latency speech-to-speech with configurable reasoning β’ supports function calling during conversation, interruptions, turn detection β’ ephemeral tokens for browser-side WebRTC so the real API key stays server-side. | ||
client.fine_tuning.jobs.create(training_file="file-abc", model="o4-mini-2025-04-16") | β’ β οΈ Platform being wound down - no longer accessible to new users β’ existing users can create training jobs for a limited period; only o4-mini available for RFT β’ fine-tuned models remain available for inference until their base model is deprecated. |