openai-text-completions
This package allows you to generate text completions using the OpenAI API from the command line.
Prerequisites
Node.js (version 8.0 or higher)
An OpenAI API key (sign up for one here)
Installation
To install the openai-text-completions package globally:
Copy code
npm install -g openai-text-completions
Usage
Set the API key
Before you can use the openai-text-completions command, you need to set your API key. To do this, use the key command followed by your API key:
Copy code
openai-text-completions key YOUR_API_KEY
Generate text completions
To generate text completions, use the completions command followed by the prompt argument:
Copy code
openai-text-completions completions "The quick brown fox"
The prompt argument should be surrounded by quotes to ensure that it is interpreted as a single string.
By default, the completions command uses the text-davinci-002 model and a temperature of 0.5. You can modify these settings by passing additional options to the completions command. For example:
Copy code
openai-text-completions completions "The quick brown fox" --model "text-davinci-002" --temperature 0.5
Check the API key
To check if the API key has been set, use the check-key command:
Copy code
openai-text-completions check-key
If the API key has been set, this command will output API key is set.. If the API key has not been set or is invalid, this command will output an error message.
License
This package is licensed under the MIT License. See the LICENSE file