JSPM

deno-openrouter-cli

1.0.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q58451F
  • License MIT

Beautiful CLI for OpenRouter API with full features - Vim-style chat, split view editor, terminal, and more

Package Exports

  • deno-openrouter-cli
  • deno-openrouter-cli/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deno-openrouter-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm version license node downloads

🚀 Deno OpenRouter CLI

A powerful terminal-based AI chat application with Vim-style keybindings

Chat with 100+ free AI models • Split view editor • Embedded terminal • Multi-key rotation


📖 Table of Contents


✨ Features

🎯 Core Features

Feature Description
Vim Keybindings Navigate like a pro with j/k, i, ESC, G/g
100+ Free Models Access Llama, Gemma, Mistral, and more
Conversation History Save, continue, rename, delete, fork conversations
Theme Support 4 built-in themes: Dark, Light, Cyberpunk, Matrix

📝 Editor Features

Feature Description
Split View Side-by-side chat + code editor
Syntax Highlighting Automatic language detection
File Browser Browse and open files with Ctrl+O
Auto Save Save with Ctrl+S

🔧 Advanced Features

Feature Description
Multi API Keys Add multiple keys, auto-rotation
Parallel Validation Validate all keys simultaneously
Embedded Terminal Run shell commands with Alt+T
File Attachment Send code files to AI with Ctrl+F
System Prompts Set custom AI personality with s
Clipboard Copy AI responses with y

📦 Installation

npm install -g deno-openrouter-cli

From Source

git clone https://github.com/denoplayground/deno-openrouter-cli.git
cd deno-openrouter-cli
npm install
npm run build
npm link

📱 Termux (Android)

# Install Node.js in Termux
pkg update && pkg install nodejs

# Install the CLI
npm install -g deno-openrouter-cli

# Run with Termux mode (keeps keyboard open)
openrouter chat --termux
# or
or chat -t

Note: Use --termux or -t flag to enable mobile-friendly mode that keeps the virtual keyboard open.


🚀 Quick Start

# Start the main chat interface
openrouter chat

# Or use the short alias
or chat

On first run, you'll be prompted to add your API key(s).


📋 Commands

Command Description
or chat Start Vim-style chat interface
or split Split view: chat + code editor
or edit -f <file> Open file in terminal editor
or models List available AI models
or config show View current configuration
or config set-key <key> Set API key
or config set-model <id> Set default model

⌨️ Keyboard Shortcuts

🔹 Normal Mode (Navigation)

Key Action
i Enter insert mode (type message)
j / Scroll down
k / Scroll up
G Jump to bottom
g Jump to top
Tab Toggle shortcuts panel

🔹 Insert Mode

Key Action
Enter Send message
ESC Exit to normal mode

🔹 Chat Management

Key Action
m Select AI model
n New conversation
c Conversation list
t Rename conversation
p Pin/unpin conversation
x Clear chat
d Delete conversation

🔹 File Operations

Key Action
Ctrl+F Attach file to message
Ctrl+O Open file browser
e Open code editor
Ctrl+S Open split view

🔹 Utilities

Key Action
y Copy last AI response
/ Search in chat
s Set system prompt
S-h Toggle history context
Alt+T Open embedded terminal
Ctrl+T Change theme
Ctrl+B Back to main chat
q Quit

🔐 API Key Setup

First Run Setup

On first run, you'll see the key management screen:

┌─ API Key Management ──────────────────────────────┐
│ API Keys configured: 3                            │
│                                                   │
│ Get your free key at: https://openrouter.ai/keys  │
│                                                   │
│ Current Keys:                                     │
│   1. sk-or-v1-abc12...xyz89                       │
│   2. sk-or-v1-def34...uvw67                       │
│                                                   │
│ Commands:                                         │
│   a - Add key(s), comma separated                 │
│   v - Validate all keys (parallel)                │
│   d - Delete last key                             │
│   Enter - Continue                                │
└───────────────────────────────────────────────────┘

Get Your Free Key

  1. Go to https://openrouter.ai/keys
  2. Sign up or login
  3. Create a new key
  4. Copy and paste into the CLI

Multiple Keys

You can add multiple keys for:

  • Load balancing: Distribute requests across keys
  • Rate limit bypass: Switch keys when one is rate limited
  • Backup: Fallback if a key expires

🎨 Modes

Chat Mode (or chat)

Full-screen Vim-style chat interface with:

  • Scrollable chat history
  • Shortcuts sidebar
  • Status bar showing mode and model

Split Mode (or split or Ctrl+S)

Two-panel layout:

  • Left: Chat interface
  • Right: Code editor with syntax highlighting

Editor Mode (or edit or e)

Terminal-based code editor with:

  • Vim keybindings
  • Line numbers
  • Save/load files

⚙️ Configuration

Environment Variables

Create a .env file in your project:

OPENROUTER_API_KEYS=key1,key2,key3

Config File

Configuration is stored automatically. View with:

or config show

Available Settings

Setting Description
apiKey Primary API key
defaultModel Default AI model ID
theme Color theme (dark/light/cyberpunk/matrix)
defaultSystemPrompt Default personality for AI

💡 Tips & Tricks

1. Fast Model Switching

Press m in normal mode to quickly switch between models.

2. Code Review

Use Ctrl+F to attach code files, then ask AI to review/explain.

3. Quick Commands

Use embedded terminal (Alt+T) to run commands without leaving chat.

4. Conversation Fork

Press o to fork a conversation and try different approaches.

5. System Prompts

Press s to set custom personality:

  • "You are a Python expert"
  • "Explain like I'm 5"
  • "Be concise and use code examples"

🤝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing)
  5. Open a Pull Request

📄 License

MIT © deno4908


Made with ❤️ for terminal enthusiasts

⭐ Star on GitHub