Accessing OpenAI APIs from cURL and Python
Call the OpenAI API at the HTTP level and from Python: keys and headers, cURL requests, the Responses, Chat Completions and legacy Completions endpoints, the Python SDK, streaming and JSON output, and the parameters that control length, randomness and repetition. Exercises run offline.
- Beginner level
- 4 modules
- 9 lessons
- 27 tasks and questions
Syllabus
01Keys, Endpoints and HTTPAuthenticate with an API key, send requests with cURL, and understand the three text-generation endpoints and their response shapes.3 lessons
02The Python SDKMake requests with the official Python library, list models, stream output and request JSON.2 lessons
03Controlling the OutputCap length and detect truncation, understand how temperature and top P shape sampling, use penalties against repetition, and build requests that respect each model's supported parameters.3 lessons
04Project: A Safe Request BuilderBuild request bodies for either endpoint that use the right parameter names and drop settings a model doesn't support.1 lesson