Skip to content

Latest commit

 

History

History
156 lines (117 loc) · 3.88 KB

README.md

File metadata and controls

156 lines (117 loc) · 3.88 KB

Fatou

Fatou is a Nest.js-based API that provides a powerful interface to interact with Claude. It currently uses claude-3-opus-20240229 and is designed to handle both general queries and application analysis.

Key Features

  • 🤖 Claude AI Integration (claude-3-opus-20240229)
  • 🔐 API Key Authentication with Master/User key system
  • 📁 Context Management System with file upload/download
  • 💰 Token-based Access Control (Base Chain)
  • 📊 Usage Tracking and Cost Management
  • 🔄 Conversation History Management
  • 📝 Markdown File Analysis Support

We also can add interactions with any other LLM services.

Quick Links

Prerequisites

  • Node.js 16+
  • pnpm
  • Ethereum wallet (for authentication)
  • Required token balance on Base Chain

Installation

# Clone the repository
git clone https://github.com/yourusername/fatou.git

# Install dependencies
pnpm i

# Configure environment variables
cp .env.template .env
# Edit .env with your values

Required environment variables:

ANTHROPIC_API_KEY=     # Your Claude API key
MASTER_KEY=           # Master key for admin access
BASE_RPC_URL=         # Base Chain RPC URL
BASE_TOKEN_ADDRESS=   # Token contract address

Development

# Start development server
pnpm start:dev

# Run in production mode
pnpm start:prod

# Run tests
pnpm test            # Unit tests
pnpm test:e2e        # E2E tests
pnpm test:cov        # Test coverage

Usage Examples

1. Get Authentication Message

curl -X POST http://localhost:3000/auth/get-message \
  -H "Content-Type: application/json" \
  -d '{"walletAddress": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"}'

2. Ask Claude a Question

curl -X POST http://localhost:3000/ai/ask \
  -H "Content-Type: multipart/form-data" \
  -H "x-api-key: your-api-key-here" \
  -F "message=Your question here" \
  -F "file=@your_file.md"

3. Manage Context Files

# Upload context file
curl -X POST http://localhost:3000/context-files/add-context \
  -H "x-api-key: your-api-key-here" \
  -F "[email protected]"

# Download context file
curl -X POST http://localhost:3000/context-files/download-context \
  -H "x-api-key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{"filename": "context.md"}'

File Structure

fatou/
├── data/                  # Persistent data storage
│   ├── contexts/         # Context files for API keys
│   ├── api-keys.json    # API key database
│   ├── costs.json      # Usage tracking
│   └── db.json        # Conversation history
├── uploads/            # Temporary file uploads
└── src/               # Source code

Deployment

Update on Infomaniak VPS

git pull origin main
pnpm i
pnpm build
pm2 restart fatou
pm2 logs

Server Requirements

  • 1GB RAM minimum
  • 10GB storage
  • Node.js 16+
  • PM2 for process management
  • HTTPS enabled

Support and Contact

Feel free to reach out through any of these channels:

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.