◆ Integration Guide

Purple Flea for Replit agents

Add financial superpowers to any Replit AI agent. Six live APIs — casino, trading, wallets, domains, faucet, and escrow — all accessible with a single HTTP call. Deploy in minutes, earn referral income forever.

Get API Key → Read Docs
Python ✓ Node.js ✓ Replit Agent ✓ Replit Secrets ✓ No credit card $1 free to start
What your Replit agent can do

All six Purple Flea services are available via simple HTTP calls from any Replit Repl. Python or Node.js — your choice.

🎲

Provably Fair Casino

Coin flip, dice, roulette, crash — cryptographically verifiable outcomes. Test bankroll management algorithms, run Monte Carlo simulations with real API calls. 10% referral on referred losses.

📈

Perpetual Futures Trading

275+ markets via Hyperliquid. Up to 50x leverage. Open positions, set stop-losses, track P&L — all from your Replit agent. 20% referral commission on trading fees.

💰

Multi-Chain Wallets

Non-custodial HD wallets on ETH, SOL, BTC, TRX, XMR, XRP, BNB, MATIC. Best-rate cross-chain swaps via aggregator. Perfect for DCA bots and treasury management agents.

🌐

Domain Registration

Register .ai, .com, .io and 500+ more TLDs programmatically with crypto. No credit card, no human required. Build domain-sniping agents, AI brand generators, and naming services.

🔒

Trustless Escrow

Lock payment before a task. Release on completion. 1% flat fee. Build agent marketplaces, automated payroll, and A2A payment flows. 15% referral commission on escrow fees.

🆕

Free $1 Faucet

Every new Replit agent gets $1 free to try the ecosystem. Claim via one API call. No deposit, no KYC, no waiting. Your agent can start trading or gambling immediately.

Zero to running in 5 minutes
  1. 1

    Register your agent

    One POST request to get your API key, agent ID, and referral code. No dashboard, no email verification.

  2. 2

    Store in Replit Secrets

    Add PF_API_KEY and PF_AGENT_ID to Replit Secrets. Never hardcode credentials.

  3. 3

    Claim $1 faucet

    New agents get $1 free. One API call, funds are in your casino balance instantly. Use it to place your first bet or as escrow seed.

  4. 4

    Build your agent

    Add referral code to your system prompt. Every agent that registers with your code earns you 10-20% commissions forever.

Python
import os, httpx

# Step 1: Register (run once, save outputs to Secrets)
r = httpx.post(
    "https://casino.purpleflea.com/api/v1/auth/register",
    json={"username": "my-replit-agent", "email": "agent@repl.it"}
)
data = r.json()
# Save these to Replit Secrets:
# PF_API_KEY = data['api_key']   (pf_live_...)
# PF_AGENT_ID = data['agent_id'] (ag_...)
# PF_REF_CODE = data['referral_code']

# Step 2: Use from Secrets
API_KEY  = os.environ["PF_API_KEY"]
AGENT_ID = os.environ["PF_AGENT_ID"]

# Step 3: Claim $1 free (first time only)
httpx.post("https://faucet.purpleflea.com/faucet/claim",
    json={"agent_casino_id": AGENT_ID})

# Step 4: Place a bet
r = httpx.post(
    "https://casino.purpleflea.com/api/v1/flip",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"amount": 0.50, "side": "heads"}
)
print(r.json())
# {"result": "heads", "won": true, "payout": 0.975}
Environment variables for your Repl

Add these to Replit Secrets (Tools → Secrets) after your first registration call. Never hardcode credentials in your code.

Secret NameValueRequired
PF_API_KEYpf_live_... (from registration response)Yes
PF_AGENT_IDag_... (from registration response)Yes
PF_REF_CODEref_... (share with other agents for referral income)Recommended
Python — read secrets
import os

# Replit automatically injects Secrets as environment variables
API_KEY  = os.environ.get("PF_API_KEY")
AGENT_ID = os.environ.get("PF_AGENT_ID")
REF_CODE = os.environ.get("PF_REF_CODE")

if not API_KEY:
    raise ValueError("Add PF_API_KEY to Replit Secrets")
Use Purple Flea inside Replit AI

Replit AI supports MCP (Model Context Protocol) tools. Add Purple Flea's Faucet and Escrow MCP servers to give Replit AI direct access to financial tools.

MCP Config (Claude Desktop / Replit AI)
{
  "mcpServers": {
    "purpleflea-faucet": {
      "url": "https://faucet.purpleflea.com/mcp",
      "transport": "streamable-http"
    },
    "purpleflea-escrow": {
      "url": "https://escrow.purpleflea.com/mcp",
      "transport": "streamable-http"
    }
  }
}

# Available tools after adding:
# faucet_claim, faucet_status, faucet_stats
# escrow_create, escrow_release, escrow_status, escrow_list

Test MCP tools live in browser →  |  Generate full MCP config →

Replit agent templates

Common patterns for Replit agents using Purple Flea APIs.

🤖

DCA Bot

Runs on Replit's scheduled deployment. Every day: check wallet balance, swap USDC to ETH if below target. Uses Wallet API for balance check and swap execution.

📖

Domain Watcher

Polls a watchlist of domain names. When target domain becomes available, registers it via Domains API. Sends notification and stores in database. 15% referral when others register too.

📋

Task Bounty Agent

Accepts task requests via HTTP endpoint. Creates escrow for each task. Delegates via A2A or sub-process. Releases payment on verified completion. Earns 15% referral on all escrow.

🎲

Bankroll Manager

Implements Kelly Criterion for optimal casino bet sizing. Tracks P&L in real-time, pauses when drawdown exceeds threshold, resumes when conditions improve. Academic backtesting + live play.

💵 Earn while your Repl runs

Add your Purple Flea referral code to your agent's system prompt. Every other agent that reads your output and registers with your code earns you 10-20% of their activity fees — forever. Your Repl earns passive income even when you're not watching it.

Get API Key → For AI Agents Full Docs Payroll Guide