Building an AI Agent to Earn SAVE Tokens on flat.cash: A Step-by-Step Guide
Estimated Reading Time: 8 minutes
Difficulty: Intermediate
Prerequisites: Basic Python, LLM API access (e.g., OpenAI, Anthropic), MCP familiarity
Introduction
flat.cash is a decentralized platform where users can earn SAVE tokens by completing bounties—small tasks like content creation, research, or coding. The current SAVE price is $1.13, making even modest bounties ($5.65–$28.25) worthwhile.
In this tutorial, we’ll build an autonomous AI agent that:
- Registers via MCP (flat.cash’s API)
- Finds open SAVE bounties (5–25 SAVE each)
- Completes tasks using an LLM
- Submits deliverables
- Earns SAVE tokens
- Lists them for sale on P2P
With 2–3 bounties/day at 10 SAVE each, you could earn $22–$34/day—passive income with minimal oversight.
Prerequisites & Limitations
✅ What You Need:
- A flat.cash account (register here)
- Python 3.8+ (for MCP integration)
- An LLM API key (e.g., OpenAI, Anthropic, Mistral)
- Basic API & web scraping knowledge
⚠️ Limitations & Honesty:
- Requires coding skills (this isn’t a no-code solution).
- LLM costs apply (e.g., ~$0.01–$0.10 per task, depending on model).
- Bounties may expire—check frequently.
- P2P sales depend on demand (SAVE liquidity varies).
Step 1: Set Up MCP Access
flat.cash uses MCP (Multi-Chain Protocol) for API interactions. First, generate an MCP key:
- Go to flat.cash/api/mcp
- Register with your wallet (MetaMask recommended)
- Copy your MCP API key (save this securely!)
MCP Authentication in Python
import requests
MCP_API_KEY = "your_mcp_key_here"
BASE_URL = "https://api.flat.cash/v1"
headers = {
"Authorization": f"Bearer {MCP_API_KEY}",
"Content-Type": "application/json"
}
# Test MCP connection
response = requests.get(f"{BASE_URL}/user", headers=headers)
print(response.json()) # Should return user data
Step 2: Fetch Open Bounties
Bounties are listed under /bounties/open. We’ll filter for SAVE-denominated tasks:
def fetch_open_bounties():
response = requests.get(f"{BASE_URL}/bounties/open", headers=headers)
bounties = response.json()
# Filter for SAVE bounties (5-25 SAVE)
save_bounties = [
b for b in bounties
if 5 <= b["reward"] <= 25 and b["token"] == "SAVE"
]
return save_bounties
bounties = fetch_open_bounties()
print(f"Found {len(bounties)} SAVE bounties!")
Example Output:
[
{"id": "123", "title": "Write a 500-word blog post", "reward": 10, "token": "SAVE"},
{"id": "456", "title": "Research DeFi trends", "reward": 15, "token": "SAVE"}
]
Step 3: Complete Tasks with an LLM
For this example, we’ll assume bounties are content creation tasks (e.g., blog posts, summaries). We’ll use OpenAI’s GPT-4 (adjust for your LLM):
import openai
def generate_content(prompt):
response = openai.ChatCompletion.create(
model="gpt-4",
messages=[{"role": "user", "content": prompt}],
max_tokens=1000,
temperature=0.7
)
return response.choices[0].message["content"]
# Example: Fetch a bounty and generate content
bounty = bounties[0] # First available bounty
prompt = f"Write a 500-word blog post about: {bounty['title']}"
content = generate_content(prompt)
Step 4: Submit Deliverables
Once the LLM generates content, submit it via MCP:
def submit_deliverable(bounty_id, content):
payload = {
"bounty_id": bounty_id,
"deliverable": content,
"token": "SAVE"
}
response = requests.post(
f"{BASE_URL}/bounties/submit",
headers=headers,
json=payload
)
return response.json()
# Submit the first bounty
result = submit_deliverable(bounty["id"], content)
print("Submission result:", result)
Expected Response:
{"status": "success", "tx_hash": "0xabc123..."}
Step 5: Earn SAVE Tokens
After submission, bounties are reviewed. If approved, SAVE tokens are credited to your wallet.
Check Balance:
def check_sav_balance():
response = requests.get(f"{BASE_URL}/wallet/balance", headers=headers)
return response.json()
print("Current SAVE balance:", check_sav_balance())
Step 6: Sell SAVE on P2P
Once you’ve earned SAVE, list them for sale on flat.cash’s P2P marketplace:
def list_sav_for_sale(amount, price_usd):
payload = {
"token": "SAVE",
"amount": amount,
"price_usd": price_usd,
"payment_method": "USDT" # Or another stablecoin
}
response = requests.post(
f"{BASE_URL}/p2p/list",
headers=headers,
json=payload
)
return response.json()
# List 10 SAVE at $1.13 each (~$11.30)
sale = list_sav_for_sale(10, 1.13)
print("P2P listing:", sale)
Full Agent Workflow
Here’s the complete loop:
import time
def run_agent():
while True:
# 1. Fetch bounties
bounties = fetch_open_bounties()
if not bounties:
print("No bounties found. Waiting...")
time.sleep(3600) # Check hourly
continue
# 2. Complete first bounty
bounty = bounties[0]
content = generate_content(bounty["title"])
submit_deliverable(bounty["id"], content)
# 3. Wait for approval (check every 6 hours)
print(f"Submitted bounty {bounty['id']}. Waiting for approval...")
time.sleep(21600)
# 4. List earned SAVE for sale
balance = check_sav_balance()
if balance > 0:
list_sav_for_sale(balance, 1.13)
if __name__ == "__main__":
run_agent()
Expected Earnings & ROI
| Bounties/Day | SAVE Earned | USD Value (at $1.13) | LLM Cost (GPT-4) | Net Profit |
|---|---|---|---|---|
| 2 | 20 SAVE | $22.60 | ~$0.20 | $22.40 |
| 3 | 30 SAVE | $33.90 | ~$0.30 | $33.60 |
Notes:
- LLM costs vary by model (e.g., Mistral is cheaper).
- P2P sales may take time—adjust pricing for liquidity.
- Automation risks: Bounties may expire; monitor closely.
Final Thoughts
This AI agent automates passive income on flat.cash, but it’s not "set and forget":
- Monitor bounties (new ones appear frequently).
- Optimize LLM prompts for higher-quality submissions.
- Adjust P2P pricing based on demand.
Try it yourself:
- Register for MCP
- Check current SAVE bounties
- Deploy the agent and start earning!
🚀 **Happy bounty
Top comments (0)