Skip to content

viralcode/openwhale

Repository files navigation

OpenWhale

OpenWhale

Self-Extensible AI Assistant πŸ‹

Built for folks who want their AI to actually do things β€” not just chat.

🚧 Active Development β€” This project is being actively built. Expect frequent updates!
🌐 OpenWhale Website β€” Coming soon
☁️ OpenWhale Hosting β€” Managed hosting coming soon


πŸ“‹ View Full Features List


What is this?

OpenWhale is an AI assistant that can take action. It connects to multiple AI models, talks on your behalf through WhatsApp/Telegram/Discord, browses the web, executes code, manages your calendar, and basically does whatever you need it to do.

Think of it as Claude, GPT-4, or DeepSeek with arms and legs.

Why OpenWhale?

  • It's agentic β€” not just a chatbot. It can use tools, run commands, send messages, and interact with the real world.
  • Use any model β€” Claude, GPT-4, DeepSeek, Groq, Gemini, Ollama. Switch whenever you want.
  • Runs anywhere β€” Docker, bare metal, your Raspberry Pi. Whatever works for you.
  • Actually secure β€” JWT auth, API keys, rate limiting, audit logs. The boring stuff that matters.

Getting Started

Prerequisites

  • Node.js 22+ β€” Required for the runtime
  • pnpm β€” Recommended package manager (handles native modules better)
# Install pnpm if you don't have it
npm install -g pnpm

Quick Start

# Clone it
git clone https://github.com/viralcode/openwhale.git
cd openwhale

# Install dependencies (use pnpm, not npm!)
pnpm install

# Allow native modules to build (important!)
pnpm approve-builds

# Set up your environment
cp .env.example .env
# Add your API keys to .env

# Run it
pnpm run dev

Docker (Recommended for Production)

docker-compose up -d

That's it. Hit http://localhost:18789/health to make sure it's alive.


Troubleshooting

better-sqlite3 bindings error

Error: Could not locate the bindings file.

This happens when using npm instead of pnpm, or when native modules weren't built properly.

Fix:

# Remove existing node_modules
rm -rf node_modules package-lock.json

# Use pnpm instead
pnpm install
pnpm approve-builds   # Select all packages when prompted
pnpm run dev

Docker build fails with "pnpm-lock.yaml is absent"

Make sure you pulled the latest version of the repository which includes the lockfile:

git pull origin main

Native module build errors on macOS

Some packages require Xcode Command Line Tools:

xcode-select --install

Dashboard

OpenWhale comes with a web dashboard for managing everything without touching the terminal.

Access it at: http://localhost:18789/dashboard

What you can do from the dashboard:

  • Chat β€” Talk to the AI with full tool support
  • Connect channels β€” Link WhatsApp, Telegram, Discord by scanning QR codes or adding tokens
  • Manage providers β€” Add API keys for Claude, GPT-4, Gemini, etc.
  • Configure skills β€” Enable GitHub, Notion, Weather, Google services
  • View message history β€” See all conversations across channels
  • Monitor system β€” Check connected channels, active sessions, audit logs

Setup Wizard

First time running? The dashboard walks you through:

  1. Checking prerequisites (Node, Python, FFmpeg)
  2. Adding your AI provider keys
  3. Connecting messaging channels
  4. Enabling skills

Authentication

The dashboard is protected by authentication.

Default credentials:

Username: admin
Password: admin

⚠️ Security Note: Change the default password after first login!

Features:

  • Session-based auth with 7-day expiry
  • Admin can create additional users
  • Password change in Settings
  • Logout button in sidebar

Connecting Channels

OpenWhale can send and receive messages through multiple platforms. Here's how to set them up:

WhatsApp

The easiest one β€” works with your personal WhatsApp account.

Via Dashboard:

  1. Go to http://localhost:18789/dashboard
  2. Navigate to Channels β†’ WhatsApp
  3. Click "Connect"
  4. Scan the QR code with your phone (WhatsApp β†’ Linked Devices β†’ Link a Device)
  5. Done! Messages to your number will be handled by the AI

Via CLI:

npm run cli whatsapp login    # Shows QR code in terminal
npm run cli whatsapp status   # Check if connected
npm run cli whatsapp logout   # Disconnect

Your session is saved in ~/.openwhale/whatsapp-auth/ so you don't need to scan again.

Telegram

  1. Create a bot with @BotFather on Telegram
  2. Copy the bot token
  3. Add to .env:
    TELEGRAM_BOT_TOKEN=your-bot-token
  4. Restart OpenWhale
  5. Message your bot β€” the AI will respond

Discord

  1. Create a bot at Discord Developer Portal
  2. Enable "Message Content Intent" under Bot settings
  3. Copy the bot token
  4. Add to .env:
    DISCORD_BOT_TOKEN=your-bot-token
  5. Invite bot to your server using the OAuth2 URL generator
  6. Restart OpenWhale

Tools

These are the built-in capabilities the AI can use. You don't need to configure anything β€” they just work.

Tool What it does
exec Run shell commands on your machine
file Read, write, list files and directories
browser Open URLs, take screenshots, interact with web pages
screenshot Capture your screen or specific windows
code_exec Run Python/JavaScript code in a sandbox
web_fetch Fetch content from URLs (APIs, web pages)
memory Remember things across conversations
cron Schedule tasks to run at specific times
canvas Generate and manipulate images
tts Text-to-speech (say things out loud)
image Analyze and process images
nodes Work with structured data and knowledge graphs

Memory System

OpenWhale has a powerful memory system (inspired by OpenClaw) that remembers context across conversations and restarts.

Storage Location

~/.openwhale/memory/
β”œβ”€β”€ MEMORY.md           # Long-term facts
β”œβ”€β”€ 2024-01-15.md       # Daily notes  
└── vector.db           # Vector embeddings for semantic search

Slash Commands

Command What it does
/memory View your memory files
/status Show session info
/reset Clear session, start fresh
/history Show recent messages

Embeddings (Vector Search)

OpenWhale supports semantic search over your memories β€” find related content by meaning, not just keywords.

Three embedding providers (just like OpenClaw):

  1. Local (no API key!) β€” Uses node-llama-cpp with a 300MB GGUF model

    • Downloads automatically on first use
    • Runs entirely on your machine
    • Model: embeddinggemma-300M-Q8_0
  2. OpenAI β€” If OPENAI_API_KEY is set

    • Model: text-embedding-3-small
    • Best accuracy, requires API key
  3. Gemini β€” If GOOGLE_API_KEY is set

    • Model: text-embedding-004
    • Good free alternative

Auto-selection order: Local β†’ OpenAI β†’ Gemini

Using Memory via Chat

Ask the AI to:

  • "Remember that my favorite color is blue" β†’ Saves to MEMORY.md
  • "Add to today's notes: meeting at 3pm" β†’ Saves to daily log
  • "Search my memory for project ideas" β†’ Vector search
  • "Index my memory files" β†’ Re-index for search
  • "Show memory status" β†’ See embedding provider info

Session Persistence

Conversations are saved to JSONL transcripts, so you can:

  • Continue where you left off after restarts
  • Keep context across multiple messages
  • Review past conversations

Extensions

OpenWhale can extend itself! Create custom automations via chat that persist and run on schedules.

Storage

Extensions are stored as TypeScript files in ~/.openwhale/extensions/

Creating Extensions via Chat

Just ask the AI:

  • "Create an extension that reminds me to drink water every hour"
  • "Make an extension that checks Bitcoin price at 9 AM and sends it to WhatsApp"
  • "Create a daily standup reminder extension"

Extension Actions

Action What it does
create Create a new extension with code and optional schedule
list List all extensions
get View an extension's code
update Modify an extension
delete Remove an extension
enable/disable Toggle an extension
run Execute an extension manually

Extension Structure

Each extension has:

{
  "name": "daily_reminder",
  "description": "Sends a daily reminder",
  "version": "1.0.0",
  "enabled": true,
  "schedule": "0 9 * * *",
  "channels": ["whatsapp"]
}

Scheduled Extensions

Use cron expressions for scheduled execution:

  • 0 9 * * * β€” Daily at 9 AM
  • 0 */2 * * * β€” Every 2 hours
  • 0 9 * * 1-5 β€” Weekdays at 9 AM

Example

// Extension code (runs daily)
const response = await fetch('https://api.coinbase.com/v2/prices/BTC-USD/spot');
const data = await response.json();
return `Bitcoin price: $${data.data.amount}`;

Extensions automatically send their return value to configured channels!


Skills are integrations with external services. They need API keys to work.

GitHub

Access repositories, issues, pull requests.

GITHUB_TOKEN=ghp_your_token

Create a token at github.com/settings/tokens with repo scope.

Weather

Current conditions and forecasts.

OPENWEATHERMAP_API_KEY=your_key

Get a free key at openweathermap.org.

Notion

Manage pages and databases.

NOTION_API_KEY=secret_your_key

Create an integration at notion.so/my-integrations.

Google Services

Calendar, Gmail, Drive, and Tasks β€” all in one.

  1. Create a project in Google Cloud Console
  2. Enable Calendar, Gmail, Drive, and Tasks APIs
  3. Create OAuth credentials (Desktop app)
  4. Download credentials.json to ~/.openwhale/google/credentials.json
  5. Run OpenWhale and visit the Google auth URL shown in logs
  6. Authorize access β€” tokens are saved automatically

1Password

Securely fetch passwords and secrets.

OP_CONNECT_TOKEN=your_connect_token
OP_CONNECT_HOST=http://localhost:8080

Requires 1Password Connect server.

Apple Notes & Reminders (macOS only)

Works automatically on Mac β€” no config needed. The AI can read/write your Notes and Reminders.

Spotify

Control playback, search music, manage playlists.

SPOTIFY_CLIENT_ID=your_client_id
SPOTIFY_CLIENT_SECRET=your_client_secret

Create an app at developer.spotify.com.

Trello

Manage boards, lists, and cards.

TRELLO_API_KEY=your_key
TRELLO_TOKEN=your_token

Get keys at trello.com/app-key.


AI Providers

OpenWhale supports 8 AI providers with automatic failover. Add the keys for whichever services you want to use.

Provider Env Variable Top Models (Feb 2026)
Anthropic ANTHROPIC_API_KEY claude-sonnet-5-20260203, claude-opus-4-5, claude-sonnet-4-5
OpenAI OPENAI_API_KEY gpt-5.2, gpt-5, gpt-4o, o4-mini
Google Gemini GOOGLE_API_KEY gemini-3-pro-preview, gemini-3-flash-preview, gemini-2.5-pro
Qwen DASHSCOPE_API_KEY qwen3-max, qwq-plus, qwen3-coder-plus, qwen3-vl-plus
DeepSeek DEEPSEEK_API_KEY deepseek-chat, deepseek-coder, deepseek-reasoner
Groq GROQ_API_KEY llama-3.3-70b-versatile, mixtral-8x7b-32768
Together AI TOGETHER_API_KEY Any open-source model
Ollama OLLAMA_HOST Local models (no API key needed)
# Example .env configuration
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GOOGLE_API_KEY=...
DASHSCOPE_API_KEY=...  # or QWEN_API_KEY
DEEPSEEK_API_KEY=...
GROQ_API_KEY=...
OLLAMA_HOST=http://localhost:11434

Fallback Order: Anthropic β†’ OpenAI β†’ Google β†’ Qwen β†’ DeepSeek β†’ Groq β†’ Together β†’ Ollama

Switch models on the fly in the dashboard or CLI.


CLI

The CLI is where the magic happens:

# Start an interactive chat
npm run chat

# Check your setup
npm run cli providers  # See which AI providers are connected
npm run cli tools      # List available tools
npm run cli channels   # Check messaging channels
npm run cli skills     # See skill status

# WhatsApp management
npm run cli whatsapp login   # Scan QR code
npm run cli whatsapp status  # Check connection
npm run cli whatsapp logout  # Disconnect

# Background daemon (keeps running after terminal closes)
npm run cli daemon install   # Install as system service
npm run cli daemon start     # Start daemon
npm run cli daemon status    # Check if running
npm run cli daemon stop      # Stop daemon

API

OpenWhale exposes an OpenAI-compatible API, so you can plug it into existing tools:

# Chat completion
curl -X POST http://localhost:18789/api/agent/chat/completions \
  -H "Authorization: Bearer your-token" \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "Hello!"}]}'

Endpoints

Endpoint Description
GET /health Health check
POST /auth/register Create account
POST /auth/login Get access token
POST /api/agent/chat/completions Chat (with tools)
GET /api/providers List AI providers
GET /api/channels List channels
GET /dashboard Web dashboard

Project Structure

src/
β”œβ”€β”€ agents/      # Multi-agent routing and orchestration
β”œβ”€β”€ auth/        # JWT, API keys, sessions
β”œβ”€β”€ channels/    # WhatsApp, Telegram, Discord, Slack adapters
β”œβ”€β”€ cli.ts       # Interactive terminal interface
β”œβ”€β”€ daemon/      # Background service (launchd on macOS)
β”œβ”€β”€ dashboard/   # Web admin panel
β”œβ”€β”€ db/          # SQLite/PostgreSQL with Drizzle ORM
β”œβ”€β”€ gateway/     # Hono-based HTTP API
β”œβ”€β”€ integrations/# Google APIs (Calendar, Gmail, Drive, Tasks)
β”œβ”€β”€ providers/   # Anthropic, OpenAI, Google, Groq, Ollama
β”œβ”€β”€ security/    # Rate limiting, RBAC, audit logs, sandboxing
β”œβ”€β”€ sessions/    # Persistent conversation history
β”œβ”€β”€ skills/      # GitHub, Notion, Spotify, Weather, Apple, etc.
└── tools/       # File, browser, code execution, screenshots

Configuration

All settings go in .env:

# Server
GATEWAY_PORT=18789
GATEWAY_HOST=0.0.0.0

# Database (SQLite by default)
DATABASE_URL=file:./data/openwhale.db
# Or PostgreSQL:
# DATABASE_URL=postgresql://user:pass@localhost:5432/openwhale

# Security β€” CHANGE THIS!
JWT_SECRET=change-me-to-something-random-at-least-32-chars
SECURITY_MODE=local  # or 'strict' for production

# Logging
LOG_LEVEL=info

Contributing

PRs welcome! If you find a bug or have an idea, open an issue. Keep it friendly.

License

MIT β€” do whatever you want with it.


Built with ❀️ by Jijo John

About

Self-Extensible AI Assistant πŸ‹

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published