DEV Community

诺离
诺离

Posted on

I Built AI Hub — A Self-Hosted Multi-Session AI Chat Platform with Claude Code CLI Under the Hood

Hey folks 👋

I've been working on a project called AI Hub and wanted to share it with the community. It's a self-hosted, web-based multi-session AI chat platform that uses Claude Code CLI as its agent engine — and it's fully open source.

GitHub: https://github.com/cih1996/ai-hub

Why I Built This

I was tired of juggling multiple terminal windows running Claude Code CLI sessions. I wanted a clean web UI where I could manage multiple AI conversations simultaneously, with real-time streaming, persistent history, and the full power of Claude Code's agentic capabilities — all from my browser.

So I built AI Hub.

What It Does

AI Hub wraps Claude Code CLI into a proper web application. Here's the architecture:

Vue 3 Frontend ←WebSocket/REST→ Go Backend ←Persistent Subprocess Pool→ Claude Code CLI
Enter fullscreen mode Exit fullscreen mode

The key features:

  • Multi-session management — Run multiple Claude Code sessions in parallel, each with its own context and history
  • Real-time streaming — WebSocket-based message streaming, so you see responses as they're generated
  • Single binary deployment — The entire app (frontend + backend) compiles into one Go binary via go embed. No Docker, no nginx, just download and run
  • OpenAI-compatible API — Expose your Claude Code sessions as an OpenAI-format API endpoint, so you can plug AI Hub into any tool that speaks OpenAI
  • Triggers (Scheduled Tasks) — Set up cron-like triggers to send messages to sessions on a schedule. Great for automated workflows
  • Channels — Connect external platforms like QQ and Feishu (Lark) as message channels, turning AI Hub into a chatbot backend
  • Project Rules — Manage per-project system prompts and rules that persist across sessions

Tech Stack

  • Backend: Go (Gin framework, WebSocket, SQLite)
  • Frontend: Vue 3 + TypeScript + Vite
  • Agent Engine: Claude Code CLI (runs as persistent subprocesses)
  • Deployment: Single binary via go embed — supports macOS, Linux, and Windows

Quick Start

Getting started takes about 30 seconds:

# 1. Make sure Claude Code CLI is installed
npm install -g @anthropic-ai/claude-code# 2. Download the latest release from GitHub
# https://github.com/cih1996/ai-hub/releases

# 3. Run it
./ai-hub

# 4. Open http://localhost:8080 in your browser
Enter fullscreen mode Exit fullscreen mode

That's it. No containers, no reverse proxies, no config files. One binary, one command.

The OpenAI-Compatible API

One thing I'm particularly proud of is the OpenAI-compatible API layer. Once AI Hub is running, you get an endpoint at http://localhost:8080/api/v1/chat/completions that speaks the OpenAI format.

This means you can use AI Hub as a backend for tools like Cursor, Continue, or any OpenAI-compatible client — but powered by Claude Code CLI under the hood.

What's Next

I'm actively working on:

  • More channel integrations (Slack, Discord, Telegram)
  • Enhanced memory and context management
  • Plugin system for extending agent capabilities
  • Better multi-user support

Try It Out

If you're interested, check out the repo: github.com/cih1996/ai-hub

Stars and feedback are always appreciated ⭐

Would love to hear your thoughts — especially if you're already using Claude Code CLI and want a better way to manage sessions. Drop a comment below!

Top comments (0)