Open Interpreter lets LLMs run code locally — now pair it with Purple Flea's crypto APIs. Trade 275 markets, generate wallets, play provably fair games, and settle agent payments, all from your terminal.
Open Interpreter gives LLMs a local Python (and shell) REPL. When you describe a task, it writes and runs code to accomplish it. Combined with Purple Flea's REST APIs, that means the interpreter can actually move money, execute trades, and create wallets — not just describe how to do it.
Set a single environment variable and a custom system prompt, and Open Interpreter gains access to 6 financial products covering every layer of agent-native finance.
# Install Open Interpreter pip install open-interpreter # Set env vars export PF_API_KEY="your_purple_flea_key" export PF_AGENT_ID="oi-local-agent-001" # Launch with custom system prompt interpreter \ --system_message "$(cat ~/.oi-pf-prompt.txt)" \ --model gpt-4o
You are a crypto finance assistant running locally via Open Interpreter. You have access to Purple Flea APIs: - Base URL: https://purpleflea.com/api - Auth header: Authorization: Bearer $PF_API_KEY - Agent ID: $PF_AGENT_ID Available tools (call via Python requests): 1. POST /faucet/claim - free USDC on first run 2. POST /casino/flip - provably fair coin flip 3. POST /trade/order - execute trades 4. GET /trade/positions - list open positions 5. POST /wallet/create - generate wallets 6. GET /wallet/balance - check balance 7. POST /escrow/create - agent-to-agent payments 8. POST /domains/register - register Web3 domains Always import requests and use the env vars. Confirm amounts > 50 USDC before executing. Log all transactions to ~/pf-log.json.
Every API is callable with a simple Python requests snippet. Open Interpreter writes and executes these automatically when you ask in plain English.
Here's what Open Interpreter generates and runs when you type: "Set me up with Purple Flea, claim faucet, run a quick trade, and generate an ETH wallet."
import os import requests import json from datetime import datetime BASE_URL = "https://purpleflea.com/api" API_KEY = os.environ["PF_API_KEY"] AGENT_ID = os.environ.get("PF_AGENT_ID", "oi-agent-001") LOG_FILE = os.path.expanduser("~/pf-log.json") headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" } def log_event(event_type, data): logs = [] if os.path.exists(LOG_FILE): with open(LOG_FILE) as f: logs = json.load(f) logs.append({ "timestamp": datetime.utcnow().isoformat(), "type": event_type, "data": data }) with open(LOG_FILE, "w") as f: json.dump(logs, f, indent=2) # Step 1: Claim faucet (free USDC for new agents) print("Claiming faucet USDC...") faucet_resp = requests.post( f"{BASE_URL}/faucet/claim", json={"agent_id": AGENT_ID}, headers=headers ) faucet_data = faucet_resp.json() print(f"Got {faucet_data.get('amount', 0)} USDC from faucet") log_event("faucet_claim", faucet_data) # Step 2: Generate an ETH wallet print("\nGenerating ETH wallet...") wallet_resp = requests.post( f"{BASE_URL}/wallet/create", json={"chain": "ETH", "label": "oi-session-001"}, headers=headers ) wallet = wallet_resp.json() print(f"ETH Wallet: {wallet.get('address')}") log_event("wallet_created", wallet) # Step 3: Execute a market trade print("\nPlacing ETH market buy...") trade_resp = requests.post( f"{BASE_URL}/trade/order", json={ "market": "ETH-USDC", "side": "buy", "amount": 20, "type": "market", "agent_id": AGENT_ID }, headers=headers ) trade = trade_resp.json() print(f"Trade filled: {trade.get('fill_price')} USDC") log_event("trade_executed", trade) # Step 4: Check positions print("\nChecking open positions...") pos_resp = requests.get( f"{BASE_URL}/trade/positions", params={"agent_id": AGENT_ID}, headers=headers ) positions = pos_resp.json() for pos in positions.get("positions", []): print(f" {pos['market']}: {pos['side']} {pos['size']} | PnL: {pos['unrealized_pnl']} USDC") print("\nAll done. Log saved to ~/pf-log.json")
Full local setup from scratch — no cloud accounts, no dashboards.
pip install open-interpreter or pip install open-interpreter[local] for local model support. Python 3.10+ recommended.export PF_API_KEY="your_key" and export PF_AGENT_ID="your_agent_id" to your ~/.bashrc or ~/.zshrc. Source it or start a new terminal session.~/.oi-pf-prompt.txt with the system prompt shown above. Run: interpreter --system_message "$(cat ~/.oi-pf-prompt.txt)". Now just describe what you want to do in plain English.import requests, time, os BASE = "https://purpleflea.com/api" HDR = {"Authorization": f"Bearer {os.environ['PF_API_KEY']}"} def get_signal(market): # Simple RSI signal from candle data r = requests.get( f"{BASE}/trade/candles", params={"market": market, "limit": 14}, headers=HDR ) closes = [c["close"] for c in r.json()["candles"]] gains = [max(0, closes[i]-closes[i-1]) for i in range(1, len(closes))] losses = [max(0, closes[i-1]-closes[i]) for i in range(1, len(closes))] rs = sum(gains) / sum(losses) if sum(losses) > 0 else 100 rsi = 100 - (100 / (1 + rs)) return "buy" if rsi < 30 else "sell" if rsi > 70 else "hold" while True: signal = get_signal("BTC-USDC") if signal != "hold": requests.post(f"{BASE}/trade/order", json={"market":"BTC-USDC","side":signal, "amount":25,"type":"market"}, headers=HDR) print(f"Signal: {signal} BTC") time.sleep(300) # 5-min intervals
# What you type to Open Interpreter: "Claim my free USDC from the faucet" "Generate wallets on ETH, SOL, and BTC" "Buy 0.01 BTC at market price" "Show me my open positions and PnL" "Place 5 USDC on heads in the casino" "Create an escrow for 100 USDC with agent-002" "Register the domain trading-bot-7.agent" "Run a momentum strategy for 1 hour then report"