OpenAI Cookbook
by OpenAI
OpenAI's own runnable recipe book — prompting, agents, evals and fine-tuning, in real notebooks rather than prose.
Overview
The Cookbook is organised into three top-level categories — "Documentation sets", "Articles" and "Examples" — with the Examples section carrying the bulk of the runnable material as Jupyter notebooks. Coverage spans model-specific prompting guides (GPT-5 variants, vision models, image generation), agent development and orchestration with the Agents SDK including multi-agent workflows, fine-tuning and optimisation techniques, integration patterns for Codex CLI, the Realtime API and MCP servers, domain-specific solutions such as automated code review, data analysis and audio processing, and a substantial body of work on evaluation and monitoring. Recent entries include "Build Your Own Code Interpreter - Dynamic Tool Generation and Execution With o3-mini" and "Evaluating Grounded Spatial Reasoning with GPT-5.5", plus migration guides for moving off legacy APIs. The site is generated from the openai/openai-cookbook GitHub repository, which carries roughly 75,100 stars and 12,700 forks under an MIT licence across about 1,419 commits, with a CONTRIBUTING.md and a steady stream of open pull requests — so recipes track new model and API releases within days rather than quarters. The README states the scope plainly: "Example code and guides for accomplishing common tasks with the OpenAI API." Examples are predominantly Python, though the patterns transfer to any language with an OpenAI SDK.
At a Glance
- Topic
- Models
- Level
- Intermediate
- Format
- Guide
- Cost
- Free
- Duration
- Self-paced reference library; individual recipes typically run 15-60 minutes each
- Provider
- OpenAI
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Format inputs, system prompts and structured outputs correctly for current OpenAI chat models
- ✓Build embeddings-based semantic search and retrieval-augmented question answering end to end
- ✓Orchestrate single and multi-agent workflows using the OpenAI Agents SDK and tool calling
- ✓Design and run model-graded evaluations, including using a stronger model as a reference-free judge
- ✓Connect models to external systems through MCP servers, the Realtime API and the Codex CLI
- ✓Apply documented reliability techniques to reduce hallucination and brittle prompt behaviour in production
- ✓Fine-tune and optimise models, and decide when fine-tuning beats prompting or retrieval
Highlights
- •Maintained by OpenAI itself, so recipes appear alongside new model and API launches instead of months later
- •Everything is a runnable notebook against your own API key — no pseudo-code, no abandoned snippets
- •Open source under MIT on GitHub (~75.1k stars, ~12.7k forks), so you can read the diff history and file issues
- •The 'Techniques to improve reliability' article is a genuine practitioner reference — it drew 302 points and 61 comments on Hacker News
- •Breadth is unusual: prompting, embeddings, agents, evals, fine-tuning, audio and vision all in one indexed place
Who It’s For
Best For
- ✓Engineers moving from the API reference to a first working prototype
- ✓Teams standing up evaluation and monitoring for an LLM feature
- ✓Developers adopting the Agents SDK or MCP who want a known-good starting point
- ✓Anyone debugging unreliable prompt behaviour who wants documented mitigations
Prerequisites
- •Working Python and Jupyter notebook familiarity
- •An OpenAI account and API key set as the OPENAI_API_KEY environment variable (or in a .env file)
- •Running the examples consumes paid API credits even though the material itself is free
FAQ
What is OpenAI Cookbook?
The OpenAI Cookbook is OpenAI's official collection of runnable example code and guides for building with its API. Rather than conceptual explanation, it ships working Jupyter notebooks and articles you can execute against your own API key, covering prompting, embeddings and retrieval, agent orchestration, fine-tuning, evaluation and production integration patterns. It is the fastest way for an engineer to go from an API reference page to something that actually runs.
Is OpenAI Cookbook free?
OpenAI Cookbook is free to access.
What level is OpenAI Cookbook for?
OpenAI Cookbook is aimed at a intermediate audience. Recommended background: Working Python and Jupyter notebook familiarity, An OpenAI account and API key set as the OPENAI_API_KEY environment variable (or in a .env file), Running the examples consumes paid API credits even though the material itself is free.
How long does OpenAI Cookbook take?
Expect roughly Self-paced reference library; individual recipes typically run 15-60 minutes each. Most learners work through it at their own pace.
What will I learn from OpenAI Cookbook?
You'll learn: Format inputs, system prompts and structured outputs correctly for current OpenAI chat models; Build embeddings-based semantic search and retrieval-augmented question answering end to end; Orchestrate single and multi-agent workflows using the OpenAI Agents SDK and tool calling; Design and run model-graded evaluations, including using a stronger model as a reference-free judge; Connect models to external systems through MCP servers, the Realtime API and the Codex CLI; Apply documented reliability techniques to reduce hallucination and brittle prompt behaviour in production; Fine-tune and optimise models, and decide when fine-tuning beats prompting or retrieval.
Topics
Sources
This page was written from 3 sources, 2 on domains other than developers.openai.com.