# OpenAI Cookbook — Official Examples and Guides for the OpenAI API

> The single largest collection of runnable OpenAI API examples, maintained by OpenAI.

- Org: OpenAI
- Date: 2022-03-11
- Category: tutorial, resource
- Source: https://github.com/openai/openai-cookbook
- Canonical page: https://ai-tldr.dev/releases/openai-cookbook/

## In short

OpenAI's official collection of example code and guides covering agents, RAG, embeddings, fine-tuning, function calling, multimodal, real-time APIs, and structured outputs. 72.7k stars.

## What it is

The OpenAI Cookbook is OpenAI's official repository of example code and guides for building applications with the OpenAI API. It covers the full surface area: prompt engineering, embeddings and semantic search, fine-tuning, agent architectures with the Agents SDK, function calling, vision, audio, Codex, real-time APIs, vector databases, and structured outputs. Most examples are in Python.

## How it works

Each example is a standalone notebook or script. The cookbook is organized by topic on developers.openai.com/cookbook with a searchable web interface, and the raw notebooks live in the GitHub repo. OpenAI updates it regularly as new API features ship.

## Why it matters

With 72.7k stars, this is the most-starred AI tutorial repository on GitHub. It is the de facto starting point for anyone building with OpenAI's API. The examples go beyond hello-world — they cover production patterns like evaluation, caching, and cost optimization.

## Who it's for

Developers building applications with OpenAI's API.

## Try it

Browse at https://developers.openai.com/cookbook or clone the repo.

## Links

- [Repo](https://github.com/openai/openai-cookbook)
- [Website](https://developers.openai.com/cookbook)
