https://github.com/daneah/openaiapi
A light wrapper around the OpenAI API using apiron
https://github.com/daneah/openaiapi
openai openai-api python-package
Last synced: about 1 year ago
JSON representation
A light wrapper around the OpenAI API using apiron
- Host: GitHub
- URL: https://github.com/daneah/openaiapi
- Owner: daneah
- License: other
- Created: 2022-12-19T23:55:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-31T11:39:27.000Z (about 1 year ago)
- Last Synced: 2025-05-01T19:41:42.482Z (about 1 year ago)
- Topics: openai, openai-api, python-package
- Language: Python
- Homepage:
- Size: 43.9 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# openaiapi
A light wrapper around the OpenAI API using [apiron](https://apiron.readthedocs.org).
## Installation
```shell
$ python -m pip install openaiapi
```
## Usage
First, make an `OPENAI_API_KEY` environment variable available whose value is your OpenAI API key. Once you have an API key in place, you can use the `OpenAI` class to generate content:
```python
>>> from openaiapi import OpenAI
>>> OpenAI.completions(json={"model": "text-davinci-003", "prompt": "What is your quest?"})
{..., 'choices': [{'text': '\n\nMy quest is to find my purpose and fulfill it.', ...}], ...}}
```
See the [package documentation](https://openaiapi.readthedocs.io) for the full list of available endpoints, and see [the OpenAI documentation](https://beta.openai.com/docs/api-reference/introduction) for the accepted/required parameters to each endpoint.