PromptsMar 29, 2026·1 min read

OpenAI Cookbook — Official Prompting Guides

Official prompting guides from OpenAI: GPT-5.2, Codex, Meta Prompting, and Realtime API guides. The definitive reference for OpenAI model optimization.

TO
TokRepo精选 · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

Browse the guides at github.com/openai/openai-cookbook or read online at cookbook.openai.com.


Intro

Official prompting guides and code examples from OpenAI. Covers best practices for every major model: GPT-5.2, GPT-5.1, GPT-5, GPT-4.1, Codex CLI, and specialized guides for meta-prompting, realtime API, and Whisper. The authoritative source for understanding how to get the best results from OpenAI models.


Prompting Guides

GPT-5.2 Prompting Guide

Latest model best practices: structured outputs, tool use, chain-of-thought, system prompt design.

Codex Prompting Guide

Optimizing prompts for the Codex CLI agent: code generation, debugging, refactoring, multi-file edits.

Meta Prompting Guide

Using AI to improve your prompts: automated prompt optimization, self-critique patterns, prompt chaining.

Realtime Prompting Guide

Best practices for the Realtime API: voice interactions, streaming responses, latency optimization.

GPT-4.1 Prompting Guide

Instruction following, long context handling, agentic coding patterns.

Code Examples

The cookbook includes runnable Jupyter notebooks for:

  • Function calling and tool use
  • Embeddings and semantic search
  • Fine-tuning workflows
  • Batch processing
  • Vision and multimodal
  • Text-to-speech and speech-to-text

Source & Thanks

Author: OpenAI Repository: openai-cookbook Website: cookbook.openai.com License: MIT

Related Assets