1.3.1 ā€¢ Published 1 year ago

askgpt v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

AskGPT šŸ¤–

This library gives your Terminal superpowers by connecting it with OpenAI API directly. It allows you to use a simple command to have a pretty similar response to what you can get with ChatGPT.

NPM package: https://www.npmjs.com/package/askgpt


Want to have it running in Telegram?

Read the docs and learn how to deploy your server in minutes!


Installation

This library should be installed globally with your preferred package manager:

npm i -g askgpt

After installation, you have to configure your API KEY to connect to OpenAI API. To do so, follow these steps:

askgpt --config
  • The terminal prompt will ask for your API key, paste it and press Enter. It will save the key in your local system.
  • You are done! Time to use OpenAI features šŸš€

Using OpenAI API

In this version of the library we support chatCompletion using gpt-3.5-turbo data model. It's more than enough for precise answers and helping with code.

To use the API directly from your terminal, run this command:

askgpt -m "how can I commit my files using Git?"

And you will receive an output with the answer from OpenAI and an approximate cost of your request (you may be in the free test tier for now so take care about reaching the credit limit!).

Available flags

We configured some flags to allow you to configure the project easily and get information about current config status. Use any of these flags along with askgpt command to access different functionalities:

ShortcutFlag nameDescriptionExample
--helpShow all available commands in your terminalaskgpt --help
--versionShow current package versionaskgpt --version
-c--configRun configuration setupaskgpt -c
-p--pathShows the path where your config file is savedaskgpt -p
-d--modelShows current data model being usedaskgpt -d
-h--historyLists all saved files and READS one of themaskgpt -h
-r--removeList all saved files and DELETES the one chosenaskgpt -r
-m--messageSend a message to OpenAI APIaskgpt -m
-t--tokensNumber of max. tokens you want for this request onlyaskgpt -m -t 10
-s--saveSaves the current request payload to a JSON fileaskgpt -m -s

Example

Output example:

āžœ  askgpt git:(main) āœ— askgpt -m
? What do you want to ask? What is this code doing?```console.log(yellow('Asking GPT...'))```

Asking GPT... What is this code doing?```console.log(yellow('Asking GPT...'))```

----------------------------
GPT response:
This code is printing the string "Asking GPT..." to the console in yellow text.

----------------------------
GPT usage:
Used a total of 44 tokens with an approximate cost of $0.00088

And in a screenshot too if you want a visual on what it looks like:

1.2.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.1.1

1 year ago

1.0.0

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago