npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

askgpt

v1.3.1

Published

askGTP package will allow you to use OpenAI chat capabilities in your terminal

Downloads

3

Readme

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:

  • Sign up to OpenAPI and go to your API Keys screen in https://beta.openai.com/account/api-keys.
  • Create a new secret key, copy its value and run the command:
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:

| Shortcut | Flag name | Description | Example | | -------- | :-------: | ---------------------------------------------------: | ---------------: | | | --help | Show all available commands in your terminal | askgpt --help | | | --version | Show current package version | askgpt --version | | -c | --config | Run configuration setup | askgpt -c | | -p | --path | Shows the path where your config file is saved | askgpt -p | | -d | --model | Shows current data model being used | askgpt -d | | -h | --history | Lists all saved files and READS one of them | askgpt -h | | -r | --remove | List all saved files and DELETES the one chosen | askgpt -r | | -m | --message | Send a message to OpenAI API | askgpt -m | | -t | --tokens | Number of max. tokens you want for this request only | askgpt -m -t 10 | | -s | --save | Saves the current request payload to a JSON file | askgpt -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: