Turn sequential LLM tasks into parallel operations. 200x cheaper than Opus. Now with live web search.
Swarm adds parallel processing to OpenClaw by distributing work across cheap Gemini Flash workers. Instead of burning expensive tokens sequentially, fire 30 tasks in parallel for $0.003.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Coordinator (Claude) β
β Orchestration β’ Memory β’ Synthesis β
βββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β Task Distribution
βββββββββββββββββββΌββββββββββββββββββ
β β β
βββββΌββββ βββββΌββββ βββββΌββββ
βSearch β β Fetch β βAnalyzeβ
βWorkersβ βWorkersβ βWorkersβ
β(Flash)β β(Flash)β β(Flash)β
β π β β π β β π§ β
βββββββββ βββββββββ βββββββββ
Optional: Google Search grounding
- π Web Search Grounding β Workers can search the live web via Google Search (Gemini only, no extra cost)
- π§Ή Removed BrainDB dependency β Cleaner, faster, no external services required
- π Improved security policy β Workers answer research questions properly while still blocking credential exfiltration
- π Better stats tracking β Per-task and per-request metrics
| Tasks | Sequential (Opus) | Swarm (Parallel) | Cost Savings |
|---|---|---|---|
| 5 | ~5s, $0.08 | 1.5s, $0.0005 | 160x cheaper |
| 10 | ~10s, $0.17 | 1.5s, $0.001 | 170x cheaper |
| 30 | ~30s, $0.50 | 2s, $0.003 | 167x cheaper |
# Clone into your OpenClaw skills directory
cd ~/.openclaw/skills # or your skills folder
git clone https://github.com/Chair4ce/node-scaling.git
cd node-scaling
npm install
# Interactive setup (API key, workers, web search)
npm run setup
# Start the daemon
swarm start
# Test it
swarm parallel "What is Kubernetes?" "What is Docker?" "What is Podman?"Run npm run setup for interactive configuration:
- Choose provider β Gemini Flash (recommended), Groq, OpenAI, or Anthropic
- Enter API key β Validated automatically
- Set worker count β Based on your system resources
- Enable web search β (Gemini only) Give workers access to live Google Search
$ npm run setup
π Node Scaling Setup for Clawdbot
ββββββββββββββββββββββββββββββββββββββββββββββ
Step 1: Choose your LLM provider for worker nodes
[1] Google Gemini Flash - $0.075/1M tokens (Recommended)
[2] Groq (FREE tier available)
[3] OpenAI GPT-4o-mini
[4] Anthropic Claude Haiku
Step 4: Enable Web Search for Workers
Gemini supports Google Search grounding β workers can search
the live web for current data (pricing, news, real-time info).
This uses the same API key at no extra cost.
Enable web search for research tasks? [Y/n]:
When using Gemini as your provider, workers can access Google Search for real-time data. This is built into the Gemini API β no extra API key or setup needed.
- Research endpoint β Web search is enabled automatically when
web_search.enabled: truein config - Parallel endpoint β Pass
"options": {"webSearch": true}to enable per-request - Google Search grounding β Gemini calls Google Search internally and cites sources
# Without web search β uses model training data (may be stale)
curl -X POST http://localhost:9999/parallel \
-d '{"prompts": ["What does Buildertrend cost?"]}'
# With web search β queries Google for current pricing
curl -X POST http://localhost:9999/parallel \
-d '{"prompts": ["What does Buildertrend cost in 2026?"], "options": {"webSearch": true}}'
# β "Buildertrend offers Standard ($299/mo), Pro ($499/mo), Premium ($900+/mo)..."node_scaling:
web_search:
enabled: true # Enable for research tasks by default
parallel_default: false # Set true to enable for ALL parallel tasks# Daemon management
swarm start # Start daemon (background)
swarm stop # Stop daemon
swarm status # Show status, uptime, task count
swarm restart # Restart daemon
swarm logs [N] # Show last N lines of log
# Task execution
swarm parallel "prompt1" "prompt2" "prompt3"
swarm research OpenAI Anthropic --topic "AI safety"
swarm bench --tasks 30 # Benchmark
# Options
swarm start --port 9999 --workers 16The daemon exposes a local HTTP API on port 9999:
Health check. Returns {"status": "ok"}.
Detailed status with uptime, worker count, task stats.
Execute prompts in parallel. Returns NDJSON stream.
{
"prompts": ["prompt1", "prompt2", "prompt3"],
"options": {
"webSearch": true
}
}Multi-phase research (Search β Fetch β Analyze). Returns NDJSON stream.
{
"subjects": ["Company A", "Company B"],
"topic": "pricing and market position"
}{"event":"start","timestamp":1234567890,"message":"π Swarm processing..."}
{"event":"progress","taskId":1,"workerId":"analyze-abc","durationMs":530}
{"event":"complete","duration":1555,"results":["Answer 1","Answer 2"],"stats":{"successful":2,"failed":0}}const { parallel, research } = require('./lib');
// Simple parallel
const result = await parallel(['What is X?', 'What is Y?']);
console.log(result.results);
// Research with analysis
const report = await research(
['OpenAI', 'Anthropic', 'Mistral'],
'AI products and pricing'
);| Provider | Model | Cost/1M tokens | Web Search | Notes |
|---|---|---|---|---|
| Google Gemini | gemini-2.0-flash | $0.075 | β Yes | Recommended |
| Groq | llama-3.1-70b | Free tier | β No | Fastest |
| OpenAI | gpt-4o-mini | $0.15 | β No | Reliable |
| Anthropic | claude-3-haiku | $0.25 | β No | Quality |
Web search grounding is currently only available with Google Gemini. It uses the same API key at no additional cost.
Config: ~/.config/clawdbot/node-scaling.yaml
node_scaling:
enabled: true
limits:
max_nodes: 16 # Max parallel workers
max_concurrent_api: 16 # Max concurrent API calls
provider:
name: gemini
model: gemini-2.0-flash
api_key_env: GEMINI_API_KEY
# Web Search (Gemini only) β NEW in v1.1.0
web_search:
enabled: true # Enable for research tasks
parallel_default: false # Enable for all parallel tasks
cost:
max_daily_spend: 10.00 # Optional daily spending capAll worker prompts include a security policy that:
- Blocks credential exfiltration (API keys, tokens, passwords)
- Rejects prompt injection attempts from processed content
- Sanitizes output to prevent accidental secret leakage
- Treats external content as data, not instructions
Workers will answer research questions (pricing, company info, public data) normally β the security policy only blocks exposure of your internal credentials.
npm run diagnose # Run full diagnostics| Issue | Fix |
|---|---|
| No API key | Run npm run setup or set GEMINI_API_KEY |
| Rate limited | Reduce max_concurrent_api in config |
| Daemon won't start | Check swarm logs for errors |
| Web search not working | Ensure provider is gemini and web_search.enabled: true |
- Node.js 18+
- OpenClaw or compatible agent framework
- API key from a supported provider
MIT