🌊
TideRAG
@carloscortezcloud/tiderag
RAG pipeline that runs 100% on Cloudflare free tier. Ingest documents, embed with Workers AI, store in Vectorize, query with ~20ms latency. Everyone else charges $70+/month for this. TideRAG costs $0.
Install
npm install @carloscortezcloud/tideragCost Comparison
| TideRAG | Pinecone | Supabase | |
|---|---|---|---|
| Monthly cost | $0 | $70+ | $25+ |
| Embeddings | Free | $0.02/1K | $0.02/1K |
| Vectors (free) | 5M | 0 | ~100K |
| Latency | ~20ms | ~80ms | ~50ms |
Cloudflare Free Tier Stack
Vectorize
5M vectors
Workers AI
Free embeddings
D1
5GB SQLite
R2
10GB storage
Usage
import { TideRAG } from '@carloscortezcloud/tiderag';
const rag = new TideRAG({
vectorize: env.VECTORIZE, // CF binding
ai: env.AI, // CF binding
d1: env.DB, // CF binding
});
// Ingest
await rag.ingest({
content: markdownText,
metadata: { source: 'docs/api.md' },
chunkStrategy: 'markdown',
});
// Query
const results = await rag.query('How do I authenticate?', { topK: 5 });
// → [{ text: "## Auth\nUse Bearer...", score: 0.87, metadata }]When to Use TideRAG
- ✓ You need RAG but don't want to pay $70+/mo for Pinecone
- ✓ Your app already runs on Cloudflare Workers
- ✓ You have <5M documents (fits in free tier)
- ✓ You want edge latency (~20ms) instead of centralized (~80ms)
- ✗ You need hybrid search (BM25 keyword — coming v0.2)
- ✗ You need multi-modal (images, audio — text only v0.1)
3 Chunking Strategies
markdown
Splits by headers (## ###). Best for documentation.
paragraph
Splits by double newlines. Best for prose/articles.
sliding
Fixed window with overlap. Best for unstructured text.
Use as Agent Tool
// Integrate as a Tinkuy agent tool:
const searchKnowledge = defineTool({
name: 'search_knowledge',
description: 'Search docs for answers',
execute: async (args) => rag.query(args.question),
});