We ramble about code, technology and life. Sometimes we actually code...


Bringing AI to Your Terminal: Meet Termai

by Kyluke McDougall on 6 October 20242 min read

Ever wanted a smart helper right in your terminal? Termai makes that possible.
Built with Rust, it brings AI capabilities directly to your command line,
turning your terminal into an interactive and intelligent workspace.

https://github.com/kyco/termai

What Is Termai?

Termai is a tool that integrates OpenAI's models into your terminal. It's
designed for single requests, offering quick answers, code snippets,
explanations, and more, all without leaving your command-line environment.

Why Use Termai?

- Smooth Integration: Work within your familiar terminal setup.
- Boosted Efficiency: Get instant responses without breaking your flow.
- Contextual Awareness: Include directories as context for more relevant
answers.
- Flexible Input: Pipe outputs from other commands directly into Termai.

Creative Use Cases

- Code Assistance: Need a function or snippet? Ask Termai right away.
- Documentation: Generate README files based on your project's code.
- Commit Messages: Pipe `git diff` into Termai for concise commit
suggestions.
- Data Summaries: Provide data and receive instant insights.

Getting Started

Add your openAI API key (create one here):

termai --chat-gpt-api-key "your api key"

Basic Query:

termai "What is the capital of France?"

Include Directory as Context:

termai "Create a README for this project" .

Request for explanations

termai "Explain this code to me" src/main.rs

Pipe Command Outputs:

git diff | termai "Create a short git commit message"

Redactions

I dislike submitting content AI's that include certain phrases or names (company names, clients, my personal name etc). It's possible to set redactions as well.

termai --redact-add "your phrase"

or

termai --redact-add "client_name"

Anything added to this list will be replaced before sending to OpenAI with '<REDACTED>'.
You can also view the list of redacted phrases/words by running

termai --redact-list

Discover how Termai can enhance your terminal experience. Give it a try and see
the difference!

https://github.com/kyco/termai