Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

πŸ€– Artificial Intelligence
☁️ Cloud and Infrastructure
πŸ’Ύ Data and Databases
πŸ’Ό Professional Skills
🎯 Programming and Development
πŸ”’ Security and Networking
πŸ“š Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
Β© 2026 CheatGridβ„’. All rights reserved.
Privacy PolicyTerms of UseAboutContact

OpenAI API Cheat Sheet

OpenAI API Cheat Sheet

Back to Generative AI
Updated 2026-04-05
Next Topic: Prompt Engineering Cheat Sheet

The OpenAI API provides programmatic access to state-of-the-art language models (GPT-5.2, GPT-5, GPT-4.1, GPT-4o, o-series), image generation (gpt-image-1), speech-to-text (Whisper, gpt-4o-transcribe), text-to-speech, embeddings, and fine-tuning capabilities. The 2025 landscape introduced the Responses API as the primary interface for agentic workflows, along with built-in tools for web search, code interpreter, file search, computer use, and Model Context Protocol (MCP) integrations. OpenAI also launched GPT-4.1 (1M context, April 2025), GPT-5 (Aug 2025), gpt-image-1 replacing DALL-E 3 (deprecated May 2026), and Reinforcement Fine-Tuning (RFT) for o4-mini. Understanding prompt engineering, structured outputs, function calling, and the token-based pricing model is essential for building reliable AI-powered applications.

What This Cheat Sheet Covers

This topic spans 18 focused tables and 160 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Core API EndpointsTable 2: Model Families and SelectionTable 3: Authentication and API KeysTable 4: Request Parameters and SamplingTable 5: Structured Outputs and JSON ModeTable 6: Function Calling and Tool UseTable 7: Prompt EngineeringTable 8: Embeddings and Vector SearchTable 9: Error Handling and Rate LimitsTable 10: Streaming and Real-time ResponsesTable 11: Multimodal and VisionTable 12: Assistants and Conversations (Legacy)Table 13: Fine-tuning and Model CustomizationTable 14: Batch Processing and Async JobsTable 15: Audio and SpeechTable 16: Usage Monitoring and BillingTable 17: Security and Best PracticesTable 18: Advanced Features

Table 1: Core API Endpoints

EndpointExampleDescription
Responses API
client.responses.create(model="gpt-5.2", input=[...])
β€’ Primary interface for stateful agentic conversations
β€’ built-in tools: web_search, file_search, code_interpreter, computer_use
β€’ supports MCP (Model Context Protocol) for external service integrations
β€’ supersedes Assistants API (sunset Aug 26, 2026).
Chat Completions API
client.chat.completions.create(model="gpt-4o", messages=[...])
β€’ Stateless endpoint for conversational AI
β€’ pass message history explicitly each request
β€’ supports JSON mode, vision, function calling, streaming
β€’ widely compatible; still recommended for simple stateless apps.
Embeddings API
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
β€’ supports dimensions param for vector compression.
Speech-to-Text
client.audio.transcriptions.create(model="gpt-4o-transcribe", file=audio)
β€’ Transcribes audio to text
β€’ gpt-4o-transcribe (new, higher accuracy) or whisper-1 (legacy)
β€’ supports 98 languages, background noise, diverse accents
β€’ translations endpoint converts to English.
Text-to-Speech
client.audio.speech.create(model="gpt-4o-mini-tts", voice="alloy", input="text")
β€’ Generates spoken audio from text
β€’ gpt-4o-mini-tts (new, steerable style/emotion) or tts-1/tts-1-hd (legacy)
β€’ 6 voices: alloy, echo, fable, onyx, nova, shimmer
β€’ formats: MP3, Opus, AAC, FLAC.

More in Generative AI

  • NL-to-SQL and Text-to-Code Generation Cheat Sheet
  • Prompt Engineering Cheat Sheet
  • Advanced RAG Patterns and Optimization Cheat Sheet
  • Chain-of-Thought Reasoning Cheat Sheet
  • Knowledge Distillation Cheat Sheet
  • MCP Servers Implementation Cheat Sheet
View all 77 topics in Generative AI