Experience lightning-speed AI conversations directly from your terminal
Note
Production-Ready AI-Powered CLI Assistant
Rusty CLI is a high-performance, asynchronous command-line interface that brings the power of GroqCloud's state-of-the-art language models directly to your terminal. Built with Rust for maximum speed, safety, and reliability.
Perfect for: Developers seeking instant AI assistance, terminal enthusiasts, productivity workflows, offline-capable AI interactions, and anyone who prefers keyboard-driven interfaces.
Rusty CLI provides the fastest path from question to answer, offering real-time streaming responses, conversation history, and seamless model switchingβall from the comfort of your terminal.
Chat with cutting-edge AI models including GPT-OSS-120B, Llama 4 Maverick, and Kimi K2, all optimized for speed and accuracy. Rusty CLI makes AI conversations instant, private, and incredibly efficient.
// Core chat functionality
let messages = vec![
Message {
role: "user".to_string(),
content: "Explain async/await in Rust".to_string(),
}
];
let response = chat_completion(&api_key, &model, &messages, true).await?;
println!("Assistant: {}", response);- What is Rusty CLI?
- Why Rust?
- Features
- Quick Start
- Installation
- Usage
- Available Models
- Commands
- Configuration
- Architecture
- Performance
- Development
- Deployment
- Contributing
- Developer Information
Rusty CLI is a modern, terminal-based AI chatbot that leverages GroqCloud's high-performance API to deliver instant AI-powered conversations. Built with Rust's async runtime (Tokio), it provides:
- Agentic Search: Autonomous tool-calling for real-time web data via Brave Search
- Smart Model Orchestration: Intelligent handling of multi-step reasoning loops
- Secure Key Management: Automated setup for Groq and Brave API keys
- Zero-Latency Design: Built with Rust/Tokio for maximum responsiveness
- Cross-Platform: Works on Linux, macOS, and Windows
- Interactive Chat: Natural conversation flow with context preservation
- Streaming Mode: Real-time token streaming for immediate feedback
- Model Switching: Change AI models mid-conversation
- Command System: Built-in commands for enhanced control
- Error Handling: Robust error recovery and user-friendly messages
- Async Architecture: Non-blocking I/O for optimal performance
Rust provides the perfect foundation for a high-performance CLI tool:
π Blazing Fast: Zero-cost abstractions and compiled performance
π Memory Safe: No segfaults, no data races, guaranteed at compile time
β‘ Async Native: Tokio runtime for efficient concurrent operations
π‘οΈ Type Safety: Strong type system catches bugs at compile time
π¦ Zero Dependencies Issues: Cargo manages dependencies reliably
π Cross-Platform: Single codebase runs everywhere
πͺ Production Ready: Used by Discord, Cloudflare, and AWS
π§΅ Fearless Concurrency: Safe parallel processing without data races
- Multi-Model Support: Three cutting-edge AI models at your fingertips
- OpenAI GPT-OSS-120B (120 billion parameters)
- Meta Llama 4 Maverick 17B (128 expert configuration)
- Moonshot AI Kimi K2 Instruct
- Agentic Capabilities: The AI can now decide to search the web for real-time information.
- Multi-Step Reasoning: Supports autonomous loops to process search results and refine answers.
- Dual API Integration: Seamless coordination between GroqCloud and Brave Search.
- π― Intuitive Commands: Simple slash commands for all operations
- π¬ Natural Conversation: Chat like you would with a human
- π Conversation Management: Clear history or start fresh anytime
- β‘ Instant Responses: Stream mode for real-time feedback
- π¨ Beautiful UI: Clean, formatted terminal output
- π± Responsive Design: Adapts to any terminal size
- π Terminal Friendly: Works with any color scheme
- π¦ Idiomatic Rust: Clean, safe, and efficient code
- π§ Modular Architecture: Easy to extend and customize
- π Well-Documented: Comprehensive code comments
- π§ͺ Error Handling: Robust error recovery mechanisms
- π Secure: Safe handling of API keys and user data
- βοΈ Configurable: Easy customization via
.envfile
- Rust 1.75 or later (Install Rust)
- GroqCloud API key (Get API Key)
- Brave Search API key (Get API Key)
- Terminal with UTF-8 support
# Clone the repository
git clone https://github.com/AlphsX/rusty-cli.git
cd rusty-cli
# Build the project
cargo build --release
# Run the CLI
cargo run --releaseThe binary will be available at target/release/rusty-cli.
-
Launch the application
cargo run --release
-
Enter your API keys when prompted
-
Select your preferred model (or press Enter for default)
[1] openai/gpt-oss-120b (default) [2] meta-llama/llama-4-maverick-17b-128e-instruct [3] moonshotai/kimi-k2-instruct-0905 -
Start chatting!
> Hello! Can you explain what makes Rust special?
Simply type your message and press Enter:
> What are the benefits of async programming in Rust?Assistant: Async programming in Rust allows you to write concurrent code without blocking threads...The assistant will respond with streaming output (if enabled) or a complete response.
Rusty CLI automatically decides when to use tools. If you ask a question about current events, it will:
- Analyze your query
- Execute a search via Brave Search
- Reason through the results
- Deliver a synthesized, accurate response
Note: Streaming is currently optimized for agentic reliability and may be suppressed during multi-step tool execution.
Switch to a different AI model:
> /model
Available models:
[1] openai/gpt-oss-120b
[2] meta-llama/llama-4-maverick-17b-128e-instruct
[3] moonshotai/kimi-k2-instruct-0905
Select a model (1-3): 2
Using model: meta-llama/llama-4-maverick-17b-128e-instructStart fresh by clearing the conversation context:
> /clear
Conversation cleared.
> [Your conversation history is now empty]Rusty CLI supports three state-of-the-art language models:
Model: openai/gpt-oss-120b
Parameters: 120 billion
Strengths: General-purpose, excellent reasoning, broad knowledge
Best for: Code generation, technical explanations, creative writing
Characteristics:
- Largest parameter count for maximum capability
- Excellent at complex reasoning and problem-solving
- Strong performance across all domains
- Ideal for technical and creative tasks
Model: meta-llama/llama-4-maverick-17b-128e-instruct
Parameters: 17 billion (128 expert configuration)
Strengths: Fast responses, efficient, instruction-following
Best for: Quick queries, code assistance, conversational AI
Characteristics:
- Mixture-of-Experts architecture for efficiency
- Faster response times with lower latency
- Excellent instruction-following capabilities
- Optimized for interactive conversations
Model: moonshotai/kimi-k2-instruct-0905
Strengths: Chinese and English, creative tasks, detailed explanations
Best for: Bilingual conversations, creative writing, detailed analysis
Characteristics:
- Native Chinese and English support
- Strong creative and analytical capabilities
- Detailed, thorough responses
- Excellent for research and exploration
| Use Case | Recommended Model |
|---|---|
| Code generation | GPT-OSS-120B |
| Quick answers | Llama 4 Maverick |
| Creative writing | Kimi K2 / GPT-OSS-120B |
| Technical explanations | GPT-OSS-120B |
| Bilingual conversations | Kimi K2 |
| Real-time interactions | Llama 4 Maverick |
| Complex problem-solving | GPT-OSS-120B |
| General conversation | Llama 4 Maverick |
Rusty CLI provides a comprehensive set of commands for controlling the chat experience:
| Command | Aliases | Description |
|---|---|---|
/quit |
/exit |
Exit the application |
/stream |
- | Toggle streaming mode on/off |
/clear |
- | Clear conversation history |
/model |
- | Change the current AI model |
/help |
- | Display available commands |
Gracefully exits the application, displaying a farewell message.
> /quit
Goodbye! π¦Toggles between streaming and non-streaming response modes.
> /stream
Streaming mode: ON
> /stream
Streaming mode: OFFStreaming Mode:
- ON: Tokens appear in real-time as the AI generates them
- OFF: Complete response appears after generation finishes
Removes all messages from the conversation history, starting fresh.
> /clear
Conversation cleared.Use cases:
- Starting a new topic
- Reducing context length
- Privacy: clearing sensitive information
- Testing different conversation flows
Interactive model selection dialog.
> /model
Available models:
[1] openai/gpt-oss-120b
[2] meta-llama/llama-4-maverick-17b-128e-instruct
[3] moonshotai/kimi-k2-instruct-0905
Select a model (1-3): 1Notes:
- Model changes take effect immediately
- Conversation history is preserved across model changes
- Invalid selections are rejected with a helpful message
Displays a summary of all available commands.
> /help
Commands:
/quit, /exit - Exit the chat
/stream - Toggle streaming mode
/clear - Clear conversation history
/model - Change modelRusty CLI stores your GroqCloud API key in a .env file in the project root.
On first run, you'll be prompted:
API Key not found.
Enter your GroqCloud API key: gsk_xxxxxxxxxxxxxxxxxxxxx
The key is automatically saved to .env:
GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxx
BRAVE_API_KEY=bsk_xxxxxxxxxxxxxxxxxxxxxYou can also manually create or edit the .env file:
# Create .env file
echo "GROQ_API_KEY=your_groq_key_here" > .env
echo "BRAVE_API_KEY=your_brave_key_here" >> .env- β
Keep
.envin.gitignore(already configured) - β Never commit API keys to version control
- β Use environment-specific keys for development/production
- β Rotate keys periodically
- β Limit key permissions in GroqCloud console
You can also set the API key via environment variable:
# Linux/macOS
export GROQ_API_KEY=your_api_key_here
cargo run --release
# Windows PowerShell
$env:GROQ_API_KEY="your_api_key_here"
cargo run --release
# Windows CMD
set GROQ_API_KEY=your_api_key_here
cargo run --releaseWhile Rusty CLI uses sensible defaults, you can customize behavior by modifying the source code:
// src/main.rs
// Change default model
const MODELS: &[&str] = &[
"openai/gpt-oss-120b", // Your preferred model first
// ... other models
];
// Adjust API endpoint
const GROQ_API_URL: &str = "https://api.groq.com/openai/v1/chat/completions";rusty-cli/
βββ src/
β βββ main.rs # Main application code
βββ .env # API key configuration (gitignored)
βββ .gitignore # Git ignore rules
βββ Cargo.toml # Rust dependencies
βββ Cargo.lock # Dependency lock file
βββ README.md # This file
#[derive(Debug, Serialize, Deserialize, Clone)]
struct Message {
role: String, // "user" or "assistant"
content: String, // The message content
}The Message struct represents a single exchange in the conversation. Messages are stored in a vector to maintain conversation history.
#[derive(Debug, Serialize)]
struct ChatRequest {
model: String, // Selected AI model
messages: Vec<Message>, // Conversation history
stream: bool, // Enable/disable streaming
}The ChatRequest struct is serialized to JSON and sent to the GroqCloud API.
// Non-streaming response
#[derive(Debug, Deserialize)]
struct ChatResponse {
choices: Vec<Choice>,
}
// Streaming response chunks
#[derive(Debug, Deserialize)]
struct StreamChunk {
choices: Vec<StreamChoice>,
}Responses are deserialized from JSON, handling both streaming and non-streaming modes.
Rusty CLI leverages Tokio for asynchronous I/O:
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Async runtime automatically manages:
// - Non-blocking HTTP requests
// - Concurrent stream processing
// - Efficient I/O operations
}Benefits:
- Non-blocking network operations
- Efficient resource utilization
- Smooth user experience
- Scalable for future features
βββββββββββ
β User β
β Input β
ββββββ¬βββββ
β
βΌ
βββββββββββββββ
β Parse & β
β Validate β
ββββββββ¬βββββββ
β
βΌ
ββββββββββββββββ βββββββββββββ
β Message βββββΊβ API Key β
β History β β Manager β
ββββββββ¬ββββββββ βββββββ¬ββββββ
β β
βΌ βΌ
ββββββββββββββββββββββββββββββ
β GroqCloud API Request β
β (with full conversation) β
βββββββββββββ¬βββββββββββββββββ
β
βΌ
ββββββββββββ
β Stream? β
βββ¬βββββ¬ββββ
Yes β β No
βΌ βΌ
βββββββββ βββββββββββ
β Token β β Completeβ
βStream β βResponse β
βββββ¬ββββ ββββββ¬βββββ
β β
βΌ βΌ
ββββββββββββββββββββ
β Display Output β
βββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββ
β Update β
β History β
βββββββββββββββ
| Technology | Purpose |
|---|---|
| Tokio | Async runtime for non-blocking I/O |
| Reqwest | HTTP client for API communication |
| Serde | JSON serialization/deserialization |
| Serde JSON | JSON data handling |
| Dotenv | Environment variable management |
[dependencies]
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.11", features = ["json", "stream"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
dotenv = "0.15"Rusty CLI is designed for speed. Here are typical performance metrics:
| Metric | Value |
|---|---|
| Cold start time | < 50ms |
| API request overhead | < 10ms |
| Token streaming latency | < 5ms per token |
| Memory footprint | ~5-10MB |
| Binary size (release) | ~8MB |
| Conversation history limit | Unlimited* |
*Limited only by available memory and API context windows
Non-blocking operations ensure the CLI remains responsive even during network requests.
// Async HTTP request doesn't block the thread
let response = client.post(GROQ_API_URL)
.json(&request)
.send()
.await?;Production builds use aggressive optimizations:
cargo build --releaseOptimizations include:
- Link-time optimization (LTO)
- Code generation optimization
- Dead code elimination
- Inline expansion
Token-by-token streaming reduces perceived latency:
// Process tokens as they arrive
while let Some(chunk) = response.chunk().await? {
print!("{}", token);
io::stdout().flush().unwrap();
}- Stack allocation for hot paths
- Minimal heap allocations
- Efficient string handling
- No unnecessary clones
For Users:
- Use release builds for production (
cargo build --release) - Enable streaming mode for faster perceived response times
- Clear conversation history periodically for long sessions
- Use Llama 4 Maverick for fastest responses
For Developers:
- Profile with
cargo flamegraphto identify hotspots - Use
cargo-bloatto analyze binary size - Enable LTO in
Cargo.tomlfor maximum optimization - Consider
tokio-consolefor async profiling
-
Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Clone Repository
git clone https://github.com/AlphsX/rusty-cli.git cd rusty-cli -
Install Dependencies
cargo build
-
Run in Development Mode
cargo run
# Development build (faster compilation, slower runtime)
cargo run
# Release build (slower compilation, faster runtime)
cargo run --release
# With environment variable
GROQ_API_KEY=your_key cargo run# Format code according to Rust style guide
cargo fmt
# Check formatting without applying changes
cargo fmt -- --check# Run Clippy linter
cargo clippy
# Fix automatically fixable issues
cargo clippy --fix
# Strict mode (treat warnings as errors)
cargo clippy -- -D warningsWhile the current version focuses on interactive use, you can add tests:
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_message_creation() {
let msg = Message {
role: "user".to_string(),
content: "Hello".to_string(),
};
assert_eq!(msg.role, "user");
assert_eq!(msg.content, "Hello");
}
#[tokio::test]
async fn test_api_connection() {
// Add your tests here
}
}Run tests:
cargo test# Build optimized release binary
cargo build --release
# Binary location
./target/release/rusty-cli
# Strip debug symbols for smaller binary
strip target/release/rusty-cli// In main loop
if trimmed == "/yourcommand" {
println!("Your custom command executed!");
// Your logic here
continue;
}// Update MODELS constant
const MODELS: &[&str] = &[
"openai/gpt-oss-120b",
"meta-llama/llama-4-maverick-17b-128e-instruct",
"moonshotai/kimi-k2-instruct-0905",
"your/new-model", // Add here
];// Add to Cargo.toml
[dependencies]
env_logger = "0.10"
log = "0.4"
// In main.rs
env_logger::init();
log::debug!("Debug message");
log::info!("Info message");Run with logging:
RUST_LOG=debug cargo runIssue: API key not found
Solution: Ensure .env file exists with GROQ_API_KEY=your_key
Issue: Connection timeout
Solution: Check internet connection and API endpoint availability
Issue: Compilation errors
Solution: Update Rust toolchain with `rustup update`
# Build for Linux
cargo build --release --target x86_64-unknown-linux-gnu
# Create distributable
tar -czf rusty-cli-linux-x86_64.tar.gz -C target/release rusty-cli# Build for macOS
cargo build --release --target x86_64-apple-darwin
# For Apple Silicon
cargo build --release --target aarch64-apple-darwin
# Create universal binary
lipo -create \
target/x86_64-apple-darwin/release/rusty-cli \
target/aarch64-apple-darwin/release/rusty-cli \
-output rusty-cli-universal# Build for Windows (from Windows)
cargo build --release --target x86_64-pc-windows-msvc
# Cross-compile from Linux/macOS
cargo build --release --target x86_64-pc-windows-gnuCreate an installation script for users:
#!/bin/bash
# install.sh
# Download latest release
curl -L https://github.com/AlphsX/rusty-cli/releases/latest/download/rusty-cli -o rusty-cli
# Make executable
chmod +x rusty-cli
# Move to PATH
sudo mv rusty-cli /usr/local/bin/
echo "Rusty CLI installed successfully!"
echo "Run 'rusty-cli' to start"# Dockerfile
FROM rust:1.75 as builder
WORKDIR /app
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim
COPY --from=builder /app/target/release/rusty-cli /usr/local/bin/
ENTRYPOINT ["rusty-cli"]Build and run:
docker build -t rusty-cli .
docker run -it --rm -e GROQ_API_KEY=your_key rusty-cliPublish to crates.io:
# Prepare for publish
cargo login
cargo publish --dry-run
# Publish
cargo publishUsers can then install via:
cargo install rusty-cliContributions are welcome! Rusty CLI is an open-source project and benefits from community involvement.
-
Fork the Repository
# Fork on GitHub, then clone git clone https://github.com/yourusername/rusty-cli.git cd rusty-cli
-
Create a Branch
git checkout -b feature/your-feature-name
-
Make Your Changes
- Write clean, idiomatic Rust code
- Follow existing code style
- Add comments for complex logic
- Update documentation as needed
-
Test Your Changes
cargo test cargo clippy cargo fmt -
Commit Your Changes
git add . git commit -m "feat: add your feature description"
-
Push and Create Pull Request
git push origin feature/your-feature-name
Then open a Pull Request on GitHub.
- Follow Rust official style guide
- Use
cargo fmtbefore committing - Address all
cargo clippywarnings - Write self-documenting code with clear variable names
Follow Conventional Commits:
feat: add new feature
fix: bug fix
docs: documentation changes
style: formatting changes
refactor: code refactoring
test: add tests
chore: maintenance tasks
- Provide clear description of changes
- Reference related issues
- Include tests for new features
- Update documentation
- Ensure CI passes
- π Bug Fixes: Report and fix bugs
- β¨ Features: Implement new functionality
- π Documentation: Improve docs and examples
- π§ͺ Testing: Add comprehensive tests
- β‘ Performance: Optimize code and algorithms
- π i18n: Add internationalization support
- π¨ UI/UX: Enhance terminal interface
- π Security: Improve security practices
Have an idea? Open an issue on GitHub with:
- Clear description of the feature
- Use case and benefits
- Proposed implementation (optional)
- Examples (if applicable)
Found a bug? Open an issue with:
- Description of the problem
- Steps to reproduce
- Expected vs actual behavior
- Environment (OS, Rust version)
- Error messages or logs
Senior Full-Stack Developer specializing in Systems Programming, AI Integration, and Developer Tools
Core Competencies:
- π¦ Rust Systems Programming & Async Architecture
- π€ AI/ML Integration & API Design
- π» CLI Tools & Developer Experience
- π§ Performance Optimization & Profiling
- π Technical Documentation & Education
- ποΈ Software Architecture & Design Patterns
Technology Stack:
- Languages: Rust, Python, TypeScript, Go
- Async Runtime: Tokio, async-std
- HTTP: Reqwest, Hyper, Actix-web
- Serialization: Serde, bincode
- CLI: clap, dialoguer, indicatif
- Testing: cargo-test, criterion (benchmarking)
Specializations:
- Async/await patterns and concurrent programming
- HTTP clients and API integration
- Terminal user interfaces (TUI)
- CLI tool development and distribution
- Performance-critical applications
- Error handling and reliability
Rusty CLI embodies the intersection of modern AI capabilities and low-level systems programming. The goals are:
- Performance First: Leveraging Rust's zero-cost abstractions
- Developer Experience: Intuitive, fast, reliable tools
- Educational Value: Clean code as teaching material
- Open Source: Free and accessible to all developers
- Production Quality: Enterprise-grade reliability
- Community Driven: Built with and for the community
- Type-Driven Development: Leverage Rust's type system
- Async-First: Non-blocking I/O for optimal performance
- Error Handling: Comprehensive Result/Option usage
- Documentation: Inline comments and external docs
- Performance: Regular profiling and optimization
- Simplicity: Minimal dependencies, maximum clarity
Committed to creating high-quality developer tools that enhance productivity and make advanced technologies accessible. This project serves as:
- π οΈ A practical tool for developers
- π A learning resource for Rust async programming
- π€ A reference for AI API integration
- π‘ An example of clean Rust architecture
- π A contribution to the open-source ecosystem
- GitHub: @AlphsX
- YouTube: @AccioLabsX
- Project Repository: Rusty
Special thanks to:
- GroqCloud for providing high-performance AI inference
- Rust Community for excellent tools and libraries
- Tokio Team for the async runtime
- Contributors for improvements and feedback
- Users for adoption and support
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2026 AlphsX, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
β Star this repository if you find it helpful!
Made with β£οΈ and π¦ for the developer community
Β© 2026 AlphsX, Inc.