OpenAI Cookbook
OpenAI's open source collection of runnable examples and guides for recurring tasks in AI application work: agents, retrieval and embeddings, structured output, function calling, evaluation, voice and realtime, vision and image generation, and cost management. It is a set of recipes to read and adapt rather than a course or architecture essays, and most techniques carry over to other providers.
76.1k
GitHub (openai/openai-cookbook) · Sept 2026
MIT
GitHub · Sept 2026
September 2026
GitHub · Sept 2026
Guide
AI & Machine Learning
OpenAI
Ongoing reference
Intermediate
Free
What it is
The cookbook is a library of Jupyter notebooks and articles maintained alongside the OpenAI API. The website now lives on OpenAI's developer site, and the source is an MIT-licensed GitHub repository with about 76,000 stars as of September 2026, updated almost daily.
Topics include:
- Agents: building with the Agents SDK and the API, computer-use agents in sandboxes, and controlled agent workflows.
- Retrieval: embeddings, chunking, vector databases and RAG patterns.
- Structured output and function calling.
- Evaluation: building eval sets and grading outputs.
- Voice and audio: transcription, realtime speech-to-speech and translation.
- Multimodal: vision, document understanding and image generation.
- Operations and integrations: batching, rate limits, cost management and working with cloud platforms and databases.
Why it is useful even with another provider
The API calls differ between vendors; the surrounding engineering does not. Chunking documents for retrieval, structuring an evaluation set, handling retries and rate limits, batching requests economically and designing tool schemas are largely the same everywhere. Adapting a cookbook recipe to another SDK is usually a small change.
How to use it
It is a cookbook in the literal sense. Reading it cover to cover is the wrong approach; searching for the recipe you need is the right one.
- Search for your task, for example "structured outputs" or "RAG evaluation".
- Check the date on the example. Older notebooks may use deprecated models or API patterns; prefer recent ones.
- Run it as is, then replace the sample data with your own.
- Keep what you learn in a small reusable module in your own project.
Good starting recipes
- A basic retrieval example with embeddings, if you are building search or question answering.
- Structured output examples, to get reliable JSON from a model.
- Function calling examples, before building anything agent-like.
- An evaluation guide, before you change prompts in production.
Weak spots
- Naturally focused on OpenAI's models and APIs.
- Quality and freshness vary between notebooks, since many authors contribute.
- It shows how, not always why; pair it with conceptual material such as Microsoft's Generative AI for Beginners.
Common questions
Is it free? The cookbook is free. Running examples calls paid APIs, so watch usage on large datasets.
Is it beginner friendly? Some recipes are. Most assume you can already call an API from Python.
Best for: engineers already building something who want a known good implementation of the next piece.
Ready to start?
Opens on OpenAI in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.