Command-line client for OpenAI API
Project description
Installation
To install OpenAI CLI in Python virtual environment, run:
pip install openai-cli
Token authentication
OpenAI API requires authentication token, which can be obtained on this page: https://beta.openai.com/account/api-keys
Provide token to the CLI either through a command-line argument (-t/--token <TOKEN>) or through an environment variable (OPENAI_API_TOKEN).
Usage
Currently only text completion API is supported.
Example usage:
$ echo "Are cats faster than dogs?" | openai complete - It depends on the breed of the cat and dog. Generally, cats are faster than dogs over short distances, but dogs are better at sustained running.
Interactive mode supported (Press Ctrl+C to exit):
$ openai repl Prompt: Can generative AI replace humans? No, generative AI cannot replace humans. While generative AI can be used to automate certain tasks, it cannot replace the creativity, intuition, and problem-solving skills that humans possess. Generative AI can be used to supplement human efforts, but it cannot replace them. Prompt: ^C
Run without arguments to get a short help message:
$ openai Usage: openai [OPTIONS] COMMAND [ARGS]... Options: --help Show this message and exit. Commands: complete Return OpenAI completion for a prompt from SOURCE. repl Start interactive shell session for OpenAI completion API.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
openai-cli-0.0.1.tar.gz
(11.7 kB
view details)
Built Distribution
File details
Details for the file openai-cli-0.0.1.tar.gz
.
File metadata
- Download URL: openai-cli-0.0.1.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10d5d06742e7967b3c703f2de2cfa9f9e491595a84db435ac9f9762c8cc0ee48 |
|
MD5 | e90f87c8c7606ea594928fe95c875b10 |
|
BLAKE2b-256 | cc09d9f40340a6f73b0f0fb1b791ff0a5077d55f95353833722eb02c45ecbf0a |
File details
Details for the file openai_cli-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: openai_cli-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad1ad80e8733906e5842556273c2f869ae5ea02a5ec97e75917fb83b857faf24 |
|
MD5 | e691b68952d723b416befe174cd22d47 |
|
BLAKE2b-256 | 3a9a006b05f19e8087f06c6400a8985b334ebd9fab06ae8d34cbe41d978140b3 |