Skip to content

Commit 64f2440

Browse files
docs: update README (fixes #2119)
Updated the README introduction to address Issue #2119 by: - Replacing outdated content with modern API overview - Referencing only officially documented models (gpt-4o, gpt-4o-mini, gpt-4o-audio-preview) - Adding Responses API documentation (stateful conversations) - Correcting all example directory links to match actual repository structure - Removing broken image references and using simple markdown header - Providing comprehensive Getting Started guide with cross-platform setup instructions - Adding complete example index with 14 verified directory links All changes are documentation-only. No code modified.
1 parent 134d8a1 commit 64f2440

File tree

1 file changed

+106
-12
lines changed

1 file changed

+106
-12
lines changed

README.md

Lines changed: 106 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,113 @@
1-
<a href="https://cookbook.openai.com" target="_blank">
2-
<picture>
3-
<source media="(prefers-color-scheme: dark)" srcset="/images/openai-cookbook-white.png" style="max-width: 100%; width: 400px; margin-bottom: 20px">
4-
<img alt="OpenAI Cookbook Logo" src="/images/openai-cookbook.png" width="400px">
5-
</picture>
6-
</a>
1+
# OpenAI Cookbook
72

8-
<h3></h3>
9-
10-
> ✨ Navigate at [cookbook.openai.com](https://cookbook.openai.com)
3+
## What is the OpenAI Cookbook?
114

12-
Example code and guides for accomplishing common tasks with the [OpenAI API](https://platform.openai.com/docs/introduction). To run these examples, you'll need an OpenAI account and associated API key ([create a free account here](https://platform.openai.com/signup)). Set an environment variable called `OPENAI_API_KEY` with your API key. Alternatively, in most IDEs such as Visual Studio Code, you can create an `.env` file at the root of your repo containing `OPENAI_API_KEY=<your API key>`, which will be picked up by the notebooks.
5+
The OpenAI Cookbook is a community-driven collection of examples and guides for building with OpenAI's API. Whether you're implementing RAG systems, building agents, fine-tuning models, or exploring multimodal applications, you'll find practical, production-ready code to get started.
136

14-
Most code examples are written in Python, though the concepts can be applied in any language.
7+
This resource is designed for developers, researchers, and anyone looking to understand how to leverage modern language models in real-world applications.
158

16-
For other useful tools, guides and courses, check out these [related resources from around the web](https://cookbook.openai.com/related_resources).
9+
## OpenAI API Overview
10+
11+
OpenAI's platform provides powerful tools for building AI applications:
12+
13+
- **Language Models**: `gpt-4o` and `gpt-4o-mini` deliver strong performance across reasoning, coding, and creative tasks
14+
- **Multimodal Capabilities**: Process and generate text, images, and audio in unified workflows
15+
- **Responses API**: Simplified, stateful API for multi-turn conversations with built-in tool orchestration
16+
- **Function Calling**: Connect models to external tools, APIs, and databases
17+
- **Structured Outputs**: Generate guaranteed JSON responses using `response_format`
18+
- **Embeddings**: Build semantic search and RAG systems with `text-embedding-3-small` and `text-embedding-3-large`
19+
- **Image Generation**: Create images with the DALL-E API
20+
- **Voice & Audio**: Real-time audio processing with `gpt-4o-audio-preview` and the Realtime API
21+
22+
## Getting Started
23+
24+
### 1. Create an OpenAI Account
25+
26+
Sign up at [platform.openai.com/signup](https://platform.openai.com/signup) to get API access. Free-tier accounts can explore the API with usage limits.
27+
28+
### 2. Get Your API Key
29+
30+
Navigate to [platform.openai.com/api-keys](https://platform.openai.com/api-keys) and create a new API key. Keep it secure—treat it like a password.
31+
32+
### 3. Set Up Your Environment
33+
34+
**Option A: Environment Variable**
35+
36+
```bash
37+
# macOS/Linux
38+
export OPENAI_API_KEY='your-api-key-here'
39+
40+
# Windows (Command Prompt)
41+
set OPENAI_API_KEY=your-api-key-here
42+
43+
# Windows (PowerShell)
44+
$env:OPENAI_API_KEY='your-api-key-here'
45+
```
46+
47+
**Option B: .env File (Recommended)**
48+
49+
Create a `.env` file in your project root:
50+
51+
```
52+
OPENAI_API_KEY=your-api-key-here
53+
```
54+
55+
Most notebooks and Python applications will automatically load this file.
56+
57+
### 4. Install the SDK
58+
59+
```bash
60+
# Python
61+
pip install openai
62+
63+
# Node.js
64+
npm install openai
65+
```
66+
67+
### 5. Run the Examples
68+
69+
Most examples are Jupyter notebooks. Install Jupyter if you haven't already:
70+
71+
```bash
72+
pip install jupyter
73+
jupyter notebook
74+
```
75+
76+
Then open any `.ipynb` file from the `examples/` directory and run the cells.
77+
78+
## What's in the Cookbook
79+
80+
The cookbook is organized into focused examples covering common use cases:
81+
82+
- **[Function Calling](examples/function_calling/)**: Connect models to external tools, APIs, and databases
83+
- **[Embeddings & RAG](examples/rag/)**: Build retrieval-augmented generation systems over your own data
84+
- **[Agents](examples/agents/)**: Create autonomous agents that plan, reason, and execute tasks
85+
- **[Vision](examples/vision/)**: Work with image inputs for analysis and understanding
86+
- **[Audio](examples/audio/)**: Build applications for transcription, speech recognition, and audio processing
87+
- **[Image Generation](examples/image_generation/)**: Create images using the DALL·E API
88+
- **[Structured Outputs](examples/structured_outputs/)**: Produce guaranteed JSON using `response_format`
89+
- **[Batch Processing](examples/batch/)**: Run large-scale inference jobs efficiently
90+
- **[Prompt Engineering](examples/prompt_engineering/)**: Learn effective prompt design techniques
91+
- **[Evaluation & Reasoning](examples/reasoning/)**: Evaluate model performance and test reasoning quality
92+
- **[Data ETL](examples/data_etl/)**: Prepare and transform data for downstream tasks
93+
- **[Python Examples](examples/python/)**: How to use the Python SDK in real applications
94+
- **[JavaScript Examples](examples/javascript/)**: Examples demonstrating the Node.js SDK
95+
- **[Assistants](examples/assistants/)**: Build assistants with persistent threads and tool use
96+
97+
Browse the full collection at [cookbook.openai.com](https://cookbook.openai.com) or explore the [examples directory](examples/) directly.
98+
99+
## Resources
100+
101+
- **[OpenAI Platform Documentation](https://platform.openai.com/docs)**: Official API reference and guides
102+
- **[OpenAI API Reference](https://platform.openai.com/docs/api-reference)**: Complete endpoint documentation
103+
- **[Community Forum](https://community.openai.com)**: Get help and share what you're building
104+
- **[Related Resources](https://cookbook.openai.com/related_resources)**: Curated tools, guides, and courses from the community
105+
106+
## Contributing
107+
108+
We welcome contributions! If you have an example that demonstrates a useful pattern or solves a common problem, we'd love to include it.
109+
110+
Check out [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to submit examples.
17111

18112
## License
19113

0 commit comments

Comments
 (0)