The OpenAI Cookbook is an open-source, community-maintained library of practical examples and reference guides for the OpenAI API. Every entry is a runnable Jupyter notebook or a focused article written by developers who have solved a real problem — and want to share how. If you’re looking for copy-paste-ready code rather than conceptual docs, you’re in the right place.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/openai/openai-cookbook/llms.txt
Use this file to discover all available pages before exploring further.
What’s inside
The cookbook organizes its 289+ examples into topic areas that map to the most common API use cases. Each category contains both introductory guides and advanced patterns you can adapt to your own projects.Models & Prompting
Understand how large language models work and write more effective prompts for GPT-5, o-series reasoning models, and open-weight alternatives.
Agents & Automation
Build multi-step agents using the OpenAI Agents SDK — with tools, handoffs, tracing, and guardrails for production systems.
Embeddings & Search
Turn text into dense vector representations and use them for semantic search, clustering, classification, and recommendation.
Fine-tuning & Evals
Customize models with your own data through supervised fine-tuning, DPO, or Reinforcement Fine-Tuning, and evaluate quality systematically.
Audio & Speech
Transcribe audio with Whisper, stream real-time conversations with the Realtime API, and synthesize natural-sounding speech with TTS.
Vision & Images
Analyze images, documents, and video frames with GPT-4o and GPT-5.4, and generate or edit images with DALL-E and GPT Image models.
How the cookbook works
Most examples are Jupyter notebooks stored underexamples/<topic>/ in the GitHub repository. Longer narrative guides live in articles/. Every piece of content is registered in registry.yaml, which is what drives the cookbook website.
Most code is written in Python, but the underlying API concepts apply to any language. Official SDKs exist for Python and Node.js, and the REST API is callable from any HTTP client.
Who contributes
The cookbook is community-driven. Examples come from OpenAI engineers, partner companies, and independent developers. You’ll find entries from enterprise integration patterns to experimental research techniques — all reviewed before publication. If you’ve built something useful with the OpenAI API, the cookbook welcomes your contribution. See the contributing guide for step-by-step instructions.Explore by section
Responses API
Stateful, tool-augmented completions with built-in file search and web browsing.
Function Calling
Give models structured access to external APIs and business logic.
Open Models
Run and fine-tune open-weight models via the OpenAI-compatible API.