2026-02-06 16:13:50 +08:00
|
|
|
# Getting Started
|
|
|
|
|
|
|
|
|
|
Welcome to AHA! This guide will help you get up and running quickly.
|
|
|
|
|
|
|
|
|
|
## Quick Start (5 Minutes)
|
|
|
|
|
|
|
|
|
|
### 1. Check Available Models
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
aha list
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 2. Download Your First Model
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Download a small text model to start
|
2026-03-31 18:45:01 +08:00
|
|
|
aha download -m Qwen/Qwen3-0.6B
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 3. Start the Service
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Start the HTTP API server
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m Qwen/Qwen3-0.6B
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The service will start on `http://127.0.0.1:10100`
|
|
|
|
|
|
|
|
|
|
### 4. Make Your First API Call
|
|
|
|
|
|
|
|
|
|
In a new terminal:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl http://127.0.0.1:10100/chat/completions \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{
|
2026-03-31 18:45:01 +08:00
|
|
|
"model": "Qwen/Qwen3-0.6B",
|
2026-02-06 16:13:50 +08:00
|
|
|
"messages": [
|
|
|
|
|
{"role": "user", "content": "Hello, AHA!"}
|
|
|
|
|
]
|
|
|
|
|
}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Basic Concepts
|
|
|
|
|
|
|
|
|
|
### What is AHA?
|
|
|
|
|
|
|
|
|
|
AHA is a local AI inference engine that:
|
|
|
|
|
- Runs models on your machine (no cloud API)
|
|
|
|
|
- Supports multiple model types (text, vision, audio, OCR, ASR)
|
|
|
|
|
- Provides an OpenAI-compatible API
|
|
|
|
|
- Works offline once models are downloaded
|
|
|
|
|
|
|
|
|
|
### Model Categories
|
|
|
|
|
|
|
|
|
|
| Category | Description | Example Models |
|
|
|
|
|
|----------|-------------|----------------|
|
|
|
|
|
| **Text** | Text generation and chat | Qwen3, MiniCPM4 |
|
|
|
|
|
| **Vision** | Image understanding | Qwen2.5VL, Qwen3VL |
|
|
|
|
|
| **OCR** | Text extraction from images | DeepSeek-OCR, Hunyuan-OCR |
|
|
|
|
|
| **ASR** | Speech-to-text | GLM-ASR, Fun-ASR, Qwen3-ASR |
|
|
|
|
|
| **Audio** | Text-to-speech | VoxCPM, VoxCPM1.5 |
|
|
|
|
|
| **Image** | Image processing | RMBG2.0 (background removal) |
|
|
|
|
|
|
|
|
|
|
### CLI Commands
|
|
|
|
|
|
|
|
|
|
| Command | Purpose |
|
|
|
|
|
|---------|---------|
|
|
|
|
|
| `aha cli` | Download model and start service |
|
|
|
|
|
| `aha serv` | Start service with existing model |
|
|
|
|
|
| `aha download` | Download model only |
|
|
|
|
|
| `aha run` | Direct inference without server |
|
|
|
|
|
| `aha list` | List available models |
|
|
|
|
|
|
|
|
|
|
## Common Workflows
|
|
|
|
|
|
|
|
|
|
### Text Generation
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Start the service
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m Qwen/Qwen3-0.6B
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
# In another terminal, make a request
|
|
|
|
|
curl http://127.0.0.1:10100/chat/completions \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{
|
2026-03-31 18:45:01 +08:00
|
|
|
"model": "Qwen/Qwen3-0.6B",
|
2026-02-06 16:13:50 +08:00
|
|
|
"messages": [
|
|
|
|
|
{"role": "system", "content": "You are a helpful assistant."},
|
|
|
|
|
{"role": "user", "content": "Explain quantum computing in simple terms."}
|
|
|
|
|
],
|
|
|
|
|
"max_tokens": 200,
|
|
|
|
|
"temperature": 0.7
|
|
|
|
|
}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Vision Understanding
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Start a vision model
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m Qwen/Qwen3-VL-2B-Instruct
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
# Analyze an image
|
|
|
|
|
curl http://127.0.0.1:10100/chat/completions \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{
|
2026-03-31 18:45:01 +08:00
|
|
|
"model": "Qwen/Qwen3-VL-2B-Instruct",
|
2026-02-06 16:13:50 +08:00
|
|
|
"messages": [
|
|
|
|
|
{
|
|
|
|
|
"role": "user",
|
|
|
|
|
"content": [
|
|
|
|
|
{"type": "text", "text": "Describe this image in detail."},
|
2026-02-07 13:28:13 +08:00
|
|
|
{"type": "image", "image_url": {"url": "file:///path/to/image.jpg"}}
|
2026-02-06 16:13:50 +08:00
|
|
|
]
|
|
|
|
|
}
|
2026-02-07 13:28:13 +08:00
|
|
|
],
|
|
|
|
|
"stream": false
|
2026-02-06 16:13:50 +08:00
|
|
|
}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### OCR (Text Extraction)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Start an OCR model
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m deepseek-ai/DeepSeek-OCR
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
# Extract text from an image
|
|
|
|
|
curl http://127.0.0.1:10100/chat/completions \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{
|
2026-03-31 18:45:01 +08:00
|
|
|
"model": "deepseek-ai/DeepSeek-OCR",
|
2026-02-06 16:13:50 +08:00
|
|
|
"messages": [
|
|
|
|
|
{
|
|
|
|
|
"role": "user",
|
|
|
|
|
"content": [
|
|
|
|
|
{"type": "text", "text": "Extract all text from this image."},
|
2026-02-07 13:28:13 +08:00
|
|
|
{"type": "image", "image_url": {"url": "file:///path/to/document.jpg"}}
|
2026-02-06 16:13:50 +08:00
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Speech Recognition (ASR)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Start an ASR model
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m ZhipuAI/GLM-ASR-Nano-2512
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
# Transcribe audio
|
|
|
|
|
curl http://127.0.0.1:10100/chat/completions \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{
|
2026-03-31 18:45:01 +08:00
|
|
|
"model": "ZhipuAI/GLM-ASR-Nano-2512",
|
2026-02-06 16:13:50 +08:00
|
|
|
"messages": [
|
|
|
|
|
{
|
|
|
|
|
"role": "user",
|
|
|
|
|
"content": [
|
|
|
|
|
{"type": "text", "text": "Transcribe this audio."},
|
2026-02-07 13:28:13 +08:00
|
|
|
{"type": "audio", "audio_url": {"url": "file:///path/to/audio.wav"}}
|
2026-02-06 16:13:50 +08:00
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Text-to-Speech
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Start a TTS model
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m OpenBMB/VoxCPM1.5
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
# Generate speech
|
|
|
|
|
curl http://127.0.0.1:10100/audio/speech \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{
|
2026-03-31 18:45:01 +08:00
|
|
|
"model": "OpenBMB/VoxCPM1.5",
|
2026-02-07 13:28:13 +08:00
|
|
|
"messages": [
|
|
|
|
|
{
|
|
|
|
|
"role": "user",
|
|
|
|
|
"content": [
|
2026-05-30 19:31:43 +08:00
|
|
|
{"type": "text", "text": "Hello, this is AHA speaking."}
|
2026-02-07 13:28:13 +08:00
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}'
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Background Removal
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Start RMBG2.0 model
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m AI-ModelScope/RMBG-2.0
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
# Remove background from image
|
|
|
|
|
curl http://127.0.0.1:10100/images/remove_background \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{
|
2026-03-31 18:45:01 +08:00
|
|
|
"model": "AI-ModelScope/RMBG-2.0",
|
2026-02-07 13:28:13 +08:00
|
|
|
"messages": [
|
|
|
|
|
{
|
|
|
|
|
"role": "user",
|
|
|
|
|
"content": [
|
|
|
|
|
{"type": "image", "image_url": {"url": "file:///path/to/document.jpg"}}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}'
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Direct Inference (Without Server)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Run inference directly without starting HTTP server
|
2026-03-31 18:45:01 +08:00
|
|
|
aha run -m Qwen/Qwen3-0.6B \
|
2026-02-06 16:13:50 +08:00
|
|
|
-i "Write a haiku about AI" \
|
2026-02-07 13:28:13 +08:00
|
|
|
--weight-path ~/.aha/Qwen/Qwen3-0.6B
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Configuration Options
|
|
|
|
|
|
|
|
|
|
### Change Port
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Use port 8080 instead of default 10100
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m Qwen/Qwen3-0.6B -p 8080
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Bind to All Interfaces
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Allow external access (use with caution)
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m Qwen/Qwen3-0.6B -a 0.0.0.0 -p 8080
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Use Local Model
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Skip download, use existing model
|
2026-03-31 18:45:01 +08:00
|
|
|
aha serv -m Qwen/Qwen3-0.6B \
|
2026-02-06 16:13:50 +08:00
|
|
|
--weight-path /path/to/model \
|
|
|
|
|
-p 8080
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Custom Save Directory
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Download model to specific directory
|
2026-03-31 18:45:01 +08:00
|
|
|
aha download -m Qwen/Qwen3-VL-2B-Instruct -s /data/models
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Streaming Responses
|
|
|
|
|
|
2026-02-07 13:28:13 +08:00
|
|
|
For chat/completions, using no "stream" field or "stream": true enables streaming, while "stream": false is for non-streaming responses:
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl http://127.0.0.1:10100/chat/completions \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{
|
2026-03-31 18:45:01 +08:00
|
|
|
"model": "Qwen/Qwen3-0.6B",
|
2026-02-06 16:13:50 +08:00
|
|
|
"messages": [
|
|
|
|
|
{"role": "user", "content": "Tell me a story"}
|
|
|
|
|
],
|
2026-02-07 13:28:13 +08:00
|
|
|
"stream": false
|
2026-02-06 16:13:50 +08:00
|
|
|
}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Model Selection Guide
|
|
|
|
|
|
|
|
|
|
### For Text Generation
|
2026-03-31 18:45:01 +08:00
|
|
|
- **Qwen/Qwen3-0.6B**: Fast, lightweight (~1.2 GB)
|
|
|
|
|
- **OpenBMB/MiniCPM4-0.5B**: Small, efficient (~1 GB)
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
### For Vision Tasks
|
2026-03-31 18:45:01 +08:00
|
|
|
- **Qwen/Qwen3-VL-2B-Instruct**: Balanced performance (~4 GB)
|
|
|
|
|
- **Qwen/Qwen3-VL-8B-Instruct**: Better quality (~16 GB)
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
### For OCR
|
2026-03-31 18:45:01 +08:00
|
|
|
- **deepseek-ai/DeepSeek-OCR**: General purpose
|
|
|
|
|
- **Tencent-Hunyuan/HunyuanOCR**: Good for Chinese text
|
|
|
|
|
- **PaddlePaddle/PaddleOCR-VL**: Lightweight option
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
### For Speech Recognition
|
2026-03-31 18:45:01 +08:00
|
|
|
- **ZhipuAI/GLM-ASR-Nano-2512**: Fast, accurate
|
|
|
|
|
- **FunAudioLLM/Fun-ASR-Nano-2512**: Good for Chinese
|
|
|
|
|
- **Qwen/Qwen3-ASR-0.6B**: Lightweight
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
### For Text-to-Speech
|
2026-03-31 18:45:01 +08:00
|
|
|
- **OpenBMB/VoxCPM1.5**: High quality Chinese
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
### For Background Removal
|
2026-03-31 18:45:01 +08:00
|
|
|
- **AI-ModelScope/RMBG-2.0**: State-of-the-art results
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
## Tips & Best Practices
|
|
|
|
|
|
|
|
|
|
### 1. Start Small
|
|
|
|
|
|
|
|
|
|
Begin with smaller models to understand the workflow:
|
|
|
|
|
```bash
|
2026-03-31 18:45:01 +08:00
|
|
|
aha download -m Qwen/Qwen3-0.6B
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 2. Use GPU Acceleration
|
|
|
|
|
|
|
|
|
|
Build with GPU support for better performance:
|
|
|
|
|
```bash
|
|
|
|
|
# NVIDIA GPUs
|
|
|
|
|
cargo build --release --features cuda
|
|
|
|
|
|
|
|
|
|
# Apple Silicon
|
|
|
|
|
cargo build --release --features metal
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 3. Pre-download Models
|
|
|
|
|
|
|
|
|
|
Download models when you have good internet:
|
|
|
|
|
```bash
|
2026-03-31 18:45:01 +08:00
|
|
|
aha download -m Qwen/Qwen3-VL-2B-Instruct
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Then use them later without internet:
|
|
|
|
|
```bash
|
2026-03-31 18:45:01 +08:00
|
|
|
aha serv -m Qwen/Qwen3-VL-2B-Instruct --weight-path ~/.aha/Qwen/Qwen3-VL-2B-Instruct
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 4. Manage Disk Space
|
|
|
|
|
|
|
|
|
|
Models are stored in `~/.aha/` by default. Clean up if needed:
|
|
|
|
|
```bash
|
|
|
|
|
# Check disk usage
|
|
|
|
|
du -sh ~/.aha/*
|
|
|
|
|
|
|
|
|
|
# Remove old models
|
|
|
|
|
rm -rf ~/.aha/old-model-name
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 5. Monitor Resources
|
|
|
|
|
|
|
|
|
|
For large models, monitor your resources:
|
|
|
|
|
```bash
|
|
|
|
|
# Linux
|
|
|
|
|
htop
|
|
|
|
|
nvidia-smi # For NVIDIA GPUs
|
|
|
|
|
|
|
|
|
|
# macOS
|
|
|
|
|
Activity Monitor
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
|
|
### Port Already in Use
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Use a different port
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m Qwen/Qwen3-0.6B -p 8080
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Model Download Failed
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Retry with more attempts
|
2026-03-31 18:45:01 +08:00
|
|
|
aha download -m Qwen/Qwen3-VL-2B-Instruct --download-retries 5
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Out of Memory
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Use a smaller model
|
2026-03-31 18:45:01 +08:00
|
|
|
aha cli -m Qwen/Qwen3-0.6B
|
2026-02-06 16:13:50 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Next Steps
|
|
|
|
|
|
|
|
|
|
1. Explore the [API Reference](./api.md) for detailed endpoint documentation
|
|
|
|
|
2. Read the [CLI Reference](./cli.md) for all command options
|
|
|
|
|
3. Check [Architecture & Design](./concepts.md) to understand how AHA works
|
|
|
|
|
4. See [Development](./development.md) if you want to contribute
|
|
|
|
|
|
|
|
|
|
## Examples Repository
|
|
|
|
|
|
2026-02-07 13:28:13 +08:00
|
|
|
For more examples, check out the [tests](../tests/) directory in the repository.
|
2026-02-06 16:13:50 +08:00
|
|
|
|
|
|
|
|
## See Also
|
|
|
|
|
|
|
|
|
|
- [API Reference](./api.md) - Complete API documentation
|
|
|
|
|
- [CLI Reference](./cli.md) - Command-line reference
|
|
|
|
|
- [Installation Guide](./installation.md) - Installation instructions
|
|
|
|
|
- [Development Guide](./development.md) - Contributing guide
|