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
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
Close
Hashes for openai_cli-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad1ad80e8733906e5842556273c2f869ae5ea02a5ec97e75917fb83b857faf24 |
|
MD5 | e691b68952d723b416befe174cd22d47 |
|
BLAKE2b-256 | 3a9a006b05f19e8087f06c6400a8985b334ebd9fab06ae8d34cbe41d978140b3 |