openai-cookbook
AGENTS.md76k starsChanged 5 months agoMITView on GitHub
The cookbook is organized around runnable examples and reference articles for OpenAI APIs. Place notebooks and Python scripts under examples/<topic>/, grouping related assets inside topic subfolders (for example, examples/agents_sdk/). Narrative guides and long-form docs live in articles/, and shared diagrams or screenshots belong in images/. Update registry.yaml whenever you add content so it appears on cookbook.openai.com, and add new author metadata in authors.yaml if you want custom attribution. Keep large datasets outside the repo; instead, document how to fetch them…
- Reads credentials
- Installs packages
Trending
Quiet since July.about the whole repository
Who's talking about openai/openai-cookbook
- A Hacker News story“Techniques to improve reliability”Hacker News · Jan 21, 2023 · 302 points
- ChatGPTNextWeb/NextChat“Zero, One and Few Shot Prompting”GitHub · Mar 29, 2023 · 59 reactions
- A Hacker News story“OpenAI Cookbook”Hacker News · Jan 10, 2023 · 51 points
- guidance-ai/guidance“Support OpenAI function calling”GitHub · Jun 13, 2023 · 28 reactions
- openai/tiktoken“added two new embedding model's encoding”GitHub · Jan 26, 2024 · 25 reactions
The biggest 5 of 61 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 61
Talked about on GitHub, Hacker News and Bluesky (61 times).
On GitHub · 27
- Mar 29, 2023Zero, One and Few Shot Prompting — ChatGPTNextWeb/NextChat59 reactions · 75 comments
- Jun 13, 2023Support OpenAI function calling — guidance-ai/guidance28 reactions · 10 comments
- Jan 26, 2024added two new embedding model's encoding — openai/tiktoken25 reactions · 11 comments
- Mar 20, 2025[Bug]: Major issues with guided generation / structured output in vLLM (up to and including v0.8.1); many examples provided by vllm in /examples and structured_outputs.html doc do not work — vllm-project/vllm10 reactions · 5 comments
- Oct 7, 2023OpenAI Streaming — microsoft/autogen7 reactions · 1 comment
22 more on GitHub
- Apr 21, 2023[Feature] 整合类似chatpdf的功能 — ChatGPTNextWeb/NextChat6 reactions · 33 comments
- Mar 5, 2023Add im_start / im_end in cl100k_base — openai/tiktoken6 reactions · 5 comments
- Aug 14, 2025[Feature Request] Enable new GPT-5 Parameters — agno-agi/agno5 reactions · 2 comments
- Jun 5, 2023Support streaming for LLMs and Chat models — davidmigloz/langchain_dart5 reactions · 7 comments
- Jun 1, 2023Want a link from the OpenAI Cookbook? — dottxt-ai/outlines5 reactions · 2 comments
- Jan 6, 2024Add function calling ability to openai extension — oobabooga/textgen4 reactions · 20 comments
- Jul 24, 2023Mind if the OpenAI Cookbook repo points to your Tiktokenizer app? — dqbd/tiktokenizer4 reactions · 3 comments
- Nov 5, 2023Finetuning in chat-mode and with input-output not yet supported — ggml-org/llama.cpp2 reactions · 1 comment
- Aug 8, 2023[FEATURE] OpenAI Chat Completion response streaming support — pathwaycom/serviette2 reactions · 1 comment
- Mar 15, 2023Add support for the optional "name" into the ChatMessage class. — betalgo/openai2 reactions · 3 comments
- Jan 2, 2023Add Fine Tuning Example — 64bit/async-openai2 reactions · 2 comments
- Jul 1, 2026optimize context usage and compaction algorith, — zew1me/fitness-coach-agent1 reaction · 5 comments
- May 5, 2026This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days. — Rastakhcarbon/Rastakhmind1 reaction
- Mar 16, 2026*: add ExecPlans guidance and PLANS.md — pingcap/tidb1 reaction · 9 comments
- Mar 10, 2026hossein ghasemi — perf-ai-example-org/openai-cookbook1 reaction · 1 comment
- Mar 2, 2026Improve Support for Long-Horizon, Multi-Session Development Tasks — openai/codex1 reaction · 6 comments
- Dec 26, 2025Add explicit content=None to assistant tool-call messages in Chat Completions converter — openai/openai-agents-python1 reaction
- Dec 18, 2025RSTK pll — Rastakhcarbon/Rastakhmind1 reaction · 1 comment
- Feb 19, 2024高级 RAG 技术图解概览 [译] — guevara/read-it-later1 reaction
- Sep 15, 2023Visualize NFCorpus embeddings — castorini/ura-projects1 reaction · 5 comments
- Aug 14, 2022Provide detailed Client API commands in ExplainaBoard Web Platform — neulab/explainaboard_web1 reaction
- Dec 11, 2024Tool-Calling 全链路:模型只提议,其余都是工程 — QingyaFan/blog0 reactions
On Hacker News · 21
- Jan 21, 2023Techniques to improve reliability302 points · 61 comments
- Jan 10, 2023OpenAI Cookbook51 points · 1 comment
- Oct 21, 2025What Makes Documentation Good6 points
- Aug 14, 2023Enhancing Whisper transcriptions: pre- & post-processing techniques5 points
- Apr 19, 2025Examples and guides for using the OpenAI API4 points
16 more on Hacker News
- Feb 28, 2024OpenAI Cookbook: Techniques to improve reliability4 points
- Aug 17, 2023OpenAI cookbook: using GPT-4 as “reference-free” evaluator3 points
- Mar 2, 2023OpenAI Cookbook: How to format inputs to ChatGPT models3 points · 1 comment
- Feb 13, 2023OpenAI Cookbook Weaviate Examples3 points
- Feb 10, 2026An Open Letter on the Epistemic Loss of Retiring GPT‑4o2 points · 3 comments
- Aug 15, 2023Question answering using a Search API2 points
- Jul 31, 2023OpenAI: How to Handle Rate Limits2 points
- Jun 2, 2023Question Answering Using Embeddings2 points
- Apr 14, 2023Question answering using embeddings-based search (OpenAI Cookbook)2 points
- Jan 8, 2023Examples and guides for using the OpenAI API2 points
- Dec 23, 2022Question Answering Using GPT Embeddings2 points
- Dec 19, 2022OpenAI Cookbook2 points
- Dec 3, 2025GPT-5.1 Apply_patch.py Implementation1 point · 1 comment
- Mar 28, 2025Vulnerability Issue related to AI response Markdown conversion1 point · 2 comments
- Mar 19, 2023API Request Parallel Processor1 point
- Dec 19, 2022Recommendation using embeddings and nearest neighbor search1 point
On Bluesky · 13
- Nov 22, 2024📦 openai / openai-cookbook ⭐ 59,906 (+28) 🗒 MDX Examples and guides for using the OpenAI API — @github-trending.bsky.social17 likes and reposts
- Feb 8, 2025📦 openai / openai-cookbook ⭐ 61,585 (+32) 🗒 MDX Examples and guides for using the OpenAI API — @github-trending.bsky.social2 likes and reposts
- Nov 22, 2024Trending today, the OpenAI Cookbook with plenty of code samples and more. github.com/openai/opena... — @trendingrepos.bsky.social2 likes and reposts
- May 16, 2024📦 openai / openai-cookbook ⭐ 56,409 (+69) 🗒 MDX Examples and guides for using the OpenAI API — @github-trending.bsky.social2 likes and reposts
- May 10, 2026OpenAI's collection of working production recipes. RAG, evals, fine-tuning, agent loops. Repo → https://github.com/openai/openai-cookbook… — @adityamitra.bsky.social1 likes and repost · 1 reply
8 more on Bluesky
- Mar 1, 2026Ever wish AI integration was less intimidating? The openai-cookbook flips the script with hands-on Python recipes and stepwise guides for… — @iam.slys.dev1 likes and repost
- Jun 10, 2025OpenAI Cookbook has a great section on preparing docs for LLM ingestion under Retrieval-Augmented Generation. It’s a helpful guide if… — @seogoddess.bsky.social1 likes and repost
- Apr 15, 2025📦 openai / openai-cookbook ⭐ 62,849 (+31) 🗒 MDX Examples and guides for using the OpenAI API — @github-trending.bsky.social1 likes and repost
- Nov 22, 2024今日のGitHubトレンド openai/openai-cookbook このリポジトリはOpenAI APIを使ったコード例とガイドを提供しています。 Python中心ですが、他の言語にも応用可能です。… — @dailygithubtrends.bsky.social1 likes and repost
- Nov 8, 2023🔥 Hot Repo! 🔥 (100+ new stars) 📦 openai / openai-cookbook ⭐ 50,070 (+102) 🗒 MDX Examples and guides for using the OpenAI API — @github-trending.bsky.social1 likes and repost · 1 reply
- Jun 15, 2023🚀 Skyrocketing!(200+ new stars today) 🚀 📦 openai / openai-cookbook ⭐ 39,451 (+355) 🗒 Jupyter Notebook Examples and guides for using the… — @github-trending.bsky.social1 likes and repost
- Aug 17, 2023🚀 Skyrocketing! 🚀 (200+ new stars) 📦 openai / openai-cookbook ⭐ 45,952 (+283) 🗒 Jupyter Notebook Examples and guides for using the… — @github-trending.bsky.social0 likes and reposts · 1 reply
- Aug 3, 2023🔥 Hot Repo! 🔥 (100+ new stars) 📦 openai / openai-cookbook ⭐ 44,527 (+125) 🗒 Jupyter Notebook Examples and guides for using the OpenAI… — @github-trending.bsky.social0 likes and reposts · 1 reply
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository4 other files it gives its agents.
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 1 is common, 3 are distinctive, and 0 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Use a virtual environment to isolate dependencies:
- Distinctive: line 37
Verify file, function, and notebook names follow the repo's naming conventions and clearly describe their purpose.
- Distinctive: line 39
Check that code identifiers remain descriptive (no leftover placeholder names) and that repeated values are factored into constants when …
- Common: line 40
Ensure notebooks or scripts document any required environment variables instead of hard-coding secrets or keys.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Repository Guidelines
Project Structure & Module Organization
The cookbook is organized around runnable examples and reference articles for OpenAI APIs. Place notebooks and Python scripts under examples/<topic>/, grouping related assets inside topic subfolders (for example, examples/agents_sdk/). Narrative guides and long-form docs live in articles/, and shared diagrams or screenshots belong in images/. Update registry.yaml whenever you add content so it appears on cookbook.openai.com, and add new author metadata in authors.yaml if you want custom attribution. Keep large datasets outside the repo; instead, document how to fetch them in the notebook.
Build, Test, and Development Commands
Use a virtual environment to isolate dependencies:
python -m venv .venv && source .venv/bin/activatepip install -r examples/<topic>/requirements.txt(each sample lists only what it needs)jupyter laborjupyter notebookto develop interactivelypython .github/scripts/check_notebooks.pyto validate notebook structure before pushing
Coding Style & Naming Conventions
Write Python to PEP 8 with four-space indentation, descriptive variable names, and concise docstrings that explain API usage choices. Name new notebooks with lowercase, dash-or-underscore-separated phrases that match their directory—for example examples/gpt-5/prompt-optimization-cookbook.ipynb. Keep markdown cells focused and prefer numbered steps for multi-part workflows. Store secrets in environment variables such as OPENAI_API_KEY; never hard-code keys inside notebooks.
Testing Guidelines
Execute notebooks top-to-bottom after installing dependencies and clear lingering execution counts before committing. For Python modules or utilities, include self-check cells or lightweight pytest snippets and show how to run them (for example, pytest examples/object_oriented_agentic_approach/tests). When contributions depend on external services, mock responses or gate the cells behind clearly labeled opt-in flags.
Commit & Pull Request Guidelines
Use concise, imperative commit messages that describe the change scope (e.g., "Add agent portfolio collaboration demo"). Every PR should provide a summary, motivation, and self-review, and must tick the registry and authors checklist from .github/pull_request_template.md. Link issues when applicable and attach screenshots or output snippets for UI-heavy content. Confirm CI notebook validation passes locally before requesting review.
Before a pull request is merged, run the repository's docs-editor skill on every changed article, Markdown or MDX file, and notebook Markdown cell. For editorial notebook changes, preserve code cells, outputs, execution counts, attachments, cell order, and metadata. Fix safe issues, rerun the relevant checks, and resolve or explicitly document all remaining P0 and P1 findings in the pull request.
Metadata & Publication Workflow
New or relocated content must have an entry in registry.yaml with an accurate path, date, and tag set so the static site generator includes it. When collaborating, coordinate author slugs in authors.yaml to avoid duplicates, and run python -m yaml lint registry.yaml (or your preferred YAML linter) to catch syntax errors before submitting.
Review Guidelines
These are considered priority 0 issues for this repo, in addition to the normal priority for possible issues.
- Verify file, function, and notebook names follow the repo's naming conventions and clearly describe their purpose.
- Scan prose and markdown for typos, broken links, and inconsistent formatting before approving.
- Check that code identifiers remain descriptive (no leftover placeholder names) and that repeated values are factored into constants when practical.
- Ensure notebooks or scripts document any required environment variables instead of hard-coding secrets or keys.
- Confirm metadata files (
registry.yaml,authors.yaml) stay in sync with new or relocated content.
Recent Learnings
uv runcan inherit the wrong virtualenv in this repo -> ClearVIRTUAL_ENV(for exampleenv -u VIRTUAL_ENV uv run ...) when an unrelated environment is active -> Avoids misleading mismatch warnings and makes it clear the repo's.venvis the interpreter actually running the harnesses.- Realtime eval shared imports can resolve the wrong module under pytest -> Add
shared/__init__.pyand ensure tests prependexamples/evals/realtime_evalstosys.pathbefore importingshared.*-> Prevents collection failures caused by unrelated installed packages namedshared. - Run-level grades can be overweighted by long simulations -> Store turn-level grades on the matching turn and trace-level grades on one row per simulation instead of copying them onto every row -> Keeps
results.csvrow semantics intact and prevents summary means from favoring longer conversations. - Synthetic-audio scaffold requests can pick the wrong harness -> Default unspecified synthetic-audio evals to
crawltext-to-TTS and reservewalkfor replay-specific audio traits like noise, telephony artifacts, or speaker characteristics -> Keeps new realtime evals on the simplest harness unless audio realism is itself under test. - Task-specific single-turn grading can outgrow the shared crawl schema -> Keep the shared crawl harness for realtime execution, then add eval-local wrapper scripts that post-grade domain-specific quality and overwrite
results.csvwhile preservingresults_base.csv-> Avoids forking the harness when a use case needs richer grading than tool-call correctness. - Synthetic learner audio can sound like eval scaffolding -> Write
user_textas a realistic in-app learner request and keep evaluation rules in metadata plus the system prompt -> Produces audio inputs that match the product surface instead of teaching the model the grading rubric through the spoken prompt.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

