#ask #api-key #openai #applications #system #information #anything

app ata

Ask the Terminal Anything² — ChatGPT¾ in your terminal

1 stable release

3.1.0 Nov 17, 2023

#1664 in Web programming

Apache-2.0

60KB
1K SLoC

ata²: Ask the Terminal Anything

ChatGPT in the terminal

asciicast

This is a fork!

The original project, ata, by Rik Huijzer is elsewhere.

This fork implements many new config options and features.

TIP:
Run a terminal with this tool in your background and show/hide it with a keypress.
This can be done via: Iterm2 (Mac), Guake (Ubuntu), scratchpad (i3/sway), yakuake (KDE), or the quake mode for the Windows Terminal.

Productivity benefits

  • The terminal starts more quickly and requires less resources than a browser.
  • The keyboard shortcuts allow for quick interaction with the query. For example, press CTRL + c to cancel the stream, CTRL + to get the previous query again, and CTRL + w to remove the last word.
  • A terminal can be set to run in the background and show/hide with one keypress. To do this, use iTerm2 (Mac), Guake (Ubuntu), scratchpad (i3/sway), or the quake mode for the Windows Terminal.
  • The prompts are reproducible because each prompt is sent as a stand-alone prompt without history. Tweaking the prompt can be done by pressing CTRL + and making changes.

Usage

Download the binary for your system from Releases. If you're running Arch Linux, then you can use the AUR package: ata2

To specify the API key and some basic model settings, start the application. It should give an error and the option to create a configuration file called ata2.toml for you. Press y and ENTER to create a ata2.toml file.

Next, request an API key via https://beta.openai.com/account/api-keys and update the key in the example configuration file.

For more information, see:

$ ata2 --help

FAQ

How much will I have to pay for the API?

Using OpenAI's API for chat is very cheap. Let's say that an average response is about 500 tokens, so costs $0.001. That means that if you do 100 requests per day, which is a lot, then that will cost you about $0.10 per day ($3 per month). OpenAI grants you $18.00 for free, so you can use the API for about 180 days (6 months) before having to pay.

How does this compare to LLM-based search engines such as You.com or Bing Chat?

At the time of writing, the OpenAI API responds much quicker than the large language model-based search engines and contains no adds. It is particularly useful to quickly look up some things like Unicode symbols, historical facts, or word meanings.

Can I build the binary myself?

Yes, you can clone the repository and build the project via Cargo. Make sure that you have Cargo installed and then run:

$ git clone https://github.com/ctrlcctrlv/ata2.git

$ cd ata2/

$ cargo build --release

After this, your binary should be available at target/release/ata2 (Unix-based) or target/release/ata2.exe (Windows).

You may also:

$ cargo install --path .

Keybindings

Keyboard shortcuts:
ata²-specific:
Ctrl-D, EOF         (In multiline mode) Send the current message.
F2                  Save the current conversation (not including the message
                    you're typing) to a file.

rustyline:
Ctrl-A, Home        Move cursor to the beginning of line
Ctrl-B, Left        Move cursor one character left
Ctrl-E, End         Move cursor to end of line
Ctrl-F, Right       Move cursor one character right
Ctrl-H, Backspace   Delete character before cursor
Ctrl-I, Tab         Next completion
Ctrl-K              Delete from cursor to end of line
Ctrl-L              Clear screen
Ctrl-N, Down        Next match from history
Ctrl-P, Up          Previous match from history
Ctrl-X Ctrl-U       Undo
Ctrl-Y              Paste from Yank buffer (Meta-Y to paste next yank instead)
Meta-<              Move to first entry in history
Meta->              Move to last entry in history
Meta-B, Alt-Left    Move cursor to previous word
Meta-C              Capitalize the current word
Meta-D              Delete forwards one word
Meta-F, Alt-Right   Move cursor to next word
Meta-L              Lower-case the next word
Meta-T              Transpose words
Meta-U              Upper-case the next word
Meta-Y              See Ctrl-Y
Meta-Backspace      Kill from the start of the current word, or, if between
                    words, to the start of the previous word
Meta-0, 1, ..., -   Specify the digit to the argument. – starts a negative
                    argument.

Thanks to <https://github.com/kkawakam/rustyline#emacs-mode-default-mode>.

License

Copyright 2023 Fredrick R. Brennan <copypaste@kittens.ph>, Rik Huijzer <rikhuijzer@pm.me>, & ATA Project Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Dependencies

~19–36MB
~602K SLoC