The OpenAI Python library provides convenient access to the OpenAI API from applications written in the Python language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which makes it compatible with a wide range of versions of the OpenAI API.
You can find usage examples for the OpenAI Python library in our API reference and the OpenAI Cookbook.
You don't need this source code unless you want to modify the package. If you just want to use the package, just run:
pip install --upgrade openaiInstall from source with:
python setup.py installInstall dependencies for openai.embeddings_utils:
pip install openai[embeddings]Install support for Weights & Biases:
pip install openai[wandb]
Data libraries like numpy and pandas are not installed by default due to their size. They’re needed for some functionality of this library, but generally not for talking to the API. If you encounter a MissingDependencyError, install them with:
pip install openai[datalib]The library needs to be configured with your account's secret key which is available on the