ExamplescriptbeginnerRunnablechat-lab
Making Requests
Runnable example (beginner) for script using openai.
Key Facts
- Level
- beginner
- Runtime
- Python • OpenAI API
- Pattern
- Single-turn interaction with inspectable output
- Interaction
- Live sandbox • Script
- Updated
- 14 March 2026
Navigate this example
Library
Browse examplesReopen the wider library to compare adjacent patterns and linked learning paths.Interaction
Run sandbox nowTry the interaction directly in this example’s guided sandbox surface.Source
Open full sourceRead the real implementation, highlighted checkpoints, and runtime requirements.MCP
Call via MCPUse the same resource inside agents, deterministic exports, and MCP setup flows.
02-making-requests.py
python
from openai import OpenAI
# The OpenAI class will automatically use the OPENAI_API_KEY environment variable
client = OpenAI()