1.0.0 ⢠Published 6 months ago
@arjunambavane/clai v1.0.0

⨠Features
- Terminal Integration: AI assistant that lives in your terminal
- Command Execution: Automatically runs shell commands on your behalf
- Multiple AI Models: Switch between various language models (Mistral, Claude, GPT, Gemini, etc.)
- Context Awareness: Maintains chat history for more contextual responses
- Beautiful TUI: Modern terminal UI built with React Ink
š¦ Installation
npm install -g claior
yarn global add claiš Prerequisites
CLAI requires an OpenRouter API key to function. If you don't have one:
- Create an account at OpenRouter.ai
- Generate an API key from your dashboard
- The API key will be requested on first run or can be set manually (see Configuration)
š Quick Start
After installation, simply run:
claiOn first run, you'll be prompted for your OpenRouter API key. After that, you can start chatting with your AI assistant.
š¬ Usage
CLAI provides two main types of responses:
1. Explanations
The AI will respond with helpful text, code examples, and guidance.
2. Command Execution
When appropriate, the AI will suggest and execute terminal commands:
- The command will be shown with an explanation
- You'll see real-time execution
- Results will be displayed directly in the chat
āļø Configuration
You can set your OpenRouter API key in one of these ways:
- Let CLAI prompt you on first run
- Create a config file at
~/.clai/config.json:{ "apiKey": "your-openrouter-api-key" }
š Model Selection
CLAI supports multiple AI models through OpenRouter:
- mistralai/mistral-7b-instruct (default)
- neversleep/noromaid-20b
- perplexity/llama-3.1-sonar-small-128k-online
- perplexity/sonar
- openai/gpt-3.5-turbo
- anthropic/claude-3.5-haiku
- google/gemini-flash-1.5-8b
To change models during a session:
- Type
/modelsat the prompt - Select your preferred model from the list
āØļø Commands
/help- Show all available commands/clear- Clear the current chat history/model- Change the AI model/exitorCtrl+C- Exit CLAI
š Project Structure
clai/
āāā components/ # React components for the TUI
āāā hooks/ # Custom React hooks
āāā utils/ # Utility functions and types
ā āāā aiClient.ts # OpenRouter API client
ā āāā models.ts # Model definitions
ā āāā chatTypes.ts # Type definitions
ā āāā config.js # Configuration management
āāā index.tsx # Application entry pointš Privacy & Security
CLAI:
- Only sends your prompts to the selected AI model via OpenRouter
- Can execute shell commands on your machine, so review before confirming
- Does not collect telemetry or user data
š TODO
- Implement previous chat context memory
- Add offline support
- Add support for command aliasing
š¤ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
š License
This project is licensed under the MIT License - see the LICENSE file for details.
1.0.0
6 months ago