The OpenAI API lets Python programs use OpenAI GPT models to generate text, images, speech, and code. It provides a programmable alternative to using the service through a web browser. section 16.0 section 16.1
Use the API as a building block for:
- Generating text, images, audio, speech, and Python code from programs. section 16.0 section 16.1
- Combining language-model capabilities with services such as Wikipedia or Wolfram Alpha through LangChain. section 16.0
- Applying few-shot, one-shot, or zero-shot prompting to control how many examples guide generation. section 16.0
Python speech-generation workflow
A Python program can call the OpenAI API to generate speech rather than relying on browser interaction. The program requires an OpenAI API key; the same interface can support text, image, and code-generation examples. section 16.1



