Skip to content

Latest commit

 

History

History
163 lines (113 loc) · 4.48 KB

File metadata and controls

163 lines (113 loc) · 4.48 KB

🌟 Open Stellar

AI-powered Moltbot gateway running on Cloudflare Workers with free Groq LLM integration

Deploy to Cloudflare Workers

✨ Features

  • 🚀 Cloudflare Workers - Runs at the edge, globally distributed
  • 🤖 Groq Integration - Free LLM API with Llama 3.3 70B (14,400 requests/day)
  • 🔒 Secure - Token-based authentication with DEV_MODE support
  • 🌐 WebSocket Support - Real-time chat interface with message streaming
  • 💾 R2 Storage - Optional persistent storage for chat history
  • 🎯 Admin UI - Built-in React dashboard for device management
  • 🔧 Debug Routes - Development tools and API testing endpoints

🚀 Quick Start

1. Get Your Free Groq API Key

  1. Go to console.groq.com
  2. Sign up for a free account
  3. Navigate to API Keys section
  4. Click Create API Key
  5. Copy your key (starts with gsk_...)

2. Clone and Setup

git clone https://github.com/bitcoindefi/Open-Stellar.git
cd Open-Stellar
npm install

3. Configure Environment

Create .dev.vars file:

# Groq Configuration
OPENAI_API_KEY=your_groq_api_key_here
OPENAI_BASE_URL=https://api.groq.com/openai/v1
MOLTBOT_GATEWAY_TOKEN=your_groq_api_key_here

# Development Settings
DEV_MODE=true
DEBUG_ROUTES=true

4. Build and Run

npm run build
npm run start

Visit http://localhost:8789 in your browser.

📚 Available Models

Open Stellar automatically configures these Groq models:

  • Llama 3.3 70B Versatile (Primary) - 131K context
  • Llama 3.1 70B Versatile - 131K context
  • Mixtral 8x7B - 32K context
  • Gemma 2 9B - 8K context

🏗️ Architecture

Browser → Cloudflare Worker → Sandbox Container → Moltbot Gateway → Groq API

The worker proxies HTTP and WebSocket traffic to a Moltbot instance running in a Cloudflare Sandbox container, which then communicates with the Groq API.

📖 Documentation

🔧 Development

npm run dev        # Start Vite dev server for UI development
npm run start      # Start wrangler dev (local worker)
npm run build      # Build worker + client
npm run deploy     # Deploy to Cloudflare Workers
npm run test       # Run tests with Vitest
npm run typecheck  # TypeScript type checking

🌐 Deployment

Prerequisites

  • Cloudflare account
  • Wrangler CLI configured
  • Domain (optional, workers.dev provided by default)

Deploy

# Set production secrets
npx wrangler secret put OPENAI_API_KEY
npx wrangler secret put MOLTBOT_GATEWAY_TOKEN

# Deploy
npm run deploy

Your worker will be available at https://your-worker.your-subdomain.workers.dev

🔐 Security Notes

  • Never commit .dev.vars to git (already in .gitignore)
  • Use npx wrangler secret put for production secrets
  • The MOLTBOT_GATEWAY_TOKEN should match your OPENAI_API_KEY for simplicity
  • Enable Cloudflare Access for production deployments

📝 Environment Variables

Required

Variable Description Example
OPENAI_API_KEY Your Groq API key gsk_...
OPENAI_BASE_URL Groq API endpoint https://api.groq.com/openai/v1
MOLTBOT_GATEWAY_TOKEN Gateway authentication token Same as API key

Optional

Variable Description Default
DEV_MODE Skip authentication checks false
DEBUG_ROUTES Enable /debug/* endpoints false
R2_ACCESS_KEY_ID R2 storage access key -
R2_SECRET_ACCESS_KEY R2 storage secret -
CF_ACCOUNT_ID Cloudflare account ID -

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT License - see LICENSE file for details

🙏 Acknowledgments

🔗 Links


Made with ❤️ for the open source community