npm package: @komilion/cli
Description: Komilion CLI - AI orchestration from your terminal
Author: Komilion
Latest version: 1.0.0

# @komilion/cli

AI orchestration from your terminal.

## Installation

```bash
npm install -g @komilion/cli
```

## Quick Start

```bash
# 1. Login with your API key
komilion login

# 2. Start chatting
komilion chat

# 3. Or run a one-shot task
komilion run -p "Explain quantum computing in simple terms"
```

## Commands

### Authentication

```bash
# Login with API key
komilion login
komilion login -k sk-komilion-your-key

# Logout
komilion logout

# Show current user
komilion whoami
```

### Chat & Tasks

```bash
# Interactive chat (default: neo-mode/balanced)
komilion chat

# Chat with specific model
komilion chat -m gpt-4o
komilion chat -m claude-3-5-sonnet

# Chat with system prompt
komilion chat -s "You are a helpful coding assistant"

# One-shot task
komilion run -p "Write a Python function to calculate fibonacci"
komilion run -p "Build a REST API spec" --mode premium
```

### Wallet & Billing

```bash
# Check balance
komilion balance

# View detailed usage (in dashboard)
# https://komilion.com/dashboard/usage
```

### Models

```bash
# List all models
komilion models

# Search models
komilion models -s claude
komilion models -s gpt
```

### Jobs (Long-running tasks)

```bash
# List recent jobs
komilion list
komilion ls -n 20

# Check job status
komilion status <job-id>

# Stream job progress
komilion stream <job-id>

# Get job result
komilion result <job-id>
komilion result <job-id> -o result.json

# Cancel a job
komilion cancel <job-id>

# Resume a cancelled job
komilion resume <job-id>
```

### Configuration

```bash
# View all config
komilion config

# Get specific value
komilion config --get apiUrl

# Set value
komilion config --set apiUrl=https://www.komilion.com/api
komilion config --set defaultModel=gpt-4o

# Show config file path
komilion config --path
```

## Environment Variables

You can also use environment variables:

```bash
export KOMILION_API_KEY=sk-komilion-your-key
export KOMILION_API_URL=https://www.komilion.com/api
```

Environment variables take precedence over stored config.

## Modes

Komilion's Neo Mode automatically selects the best model for your task:

| Mode | Description | Use Case |
|------|-------------|----------|
| `frugal` | Cheapest models | High-volume, simple tasks |
| `balanced` | Best value (default) | General use |
| `premium` | Top models | Complex reasoning, important tasks |

```bash
# Use modes with run or chat
komilion run -p "..." --mode frugal
komilion chat -m neo-mode/premium
```

## Examples

### Interactive Coding Session

```bash
$ komilion chat -s "You are an expert Python developer"

You: How do I read a CSV file?
AI: Here's how to read a CSV file in Python...

You: Now add error handling
AI: Here's the updated code with error handling...
```

### Generate and Save

```bash
# Generate content and pipe to file
komilion run -p "Write a README for a Node.js project" > README.md

# Or use result with job ID
komilion result abc123 -o output.md
```

### Batch Processing

```bash
# Process multiple prompts
for prompt in "task 1" "task 2" "task 3"; do
  komilion run -p "$prompt" --mode frugal
done
```

## Troubleshooting

### "Not authenticated"

Run `komilion login` to set your API key.

### "Insufficient balance"

Top up at https://komilion.com/dashboard

### "Rate limited"

Wait a moment and try again, or use `--mode frugal` for lower limits.

## Links

- **Dashboard**: https://komilion.com/dashboard
- **Docs**: https://komilion.com/docs
- **API Keys**: https://komilion.com/dashboard/api-keys

## License

MIT