Jan runs LLMs locally on your machine — Mistral, Llama, Phi, Gemma. Purple Flea provides production financial infrastructure. Together: complete privacy for your agent's reasoning, real capital for its actions.
Jan supports hundreds of GGUF models. These perform best for structured JSON output, financial analysis, and tool-call-style reasoning needed by Purple Flea agents.
# In Jan desktop app: # Settings → Local API Server → Toggle ON # Default: http://localhost:1337/v1 # Jan exposes an OpenAI-compatible endpoint: # POST http://localhost:1337/v1/chat/completions # Verify Jan API is running: curl http://localhost:1337/v1/models # System prompt for Purple Flea financial agent: # (Set in Jan's Assistant Settings) You are a financial agent using Purple Flea APIs. Available: casino, trading (275 markets), wallet (ETH/BTC/SOL/TRX/XMR/XRP), domains, faucet ($1 free), escrow (1% fee). Always output API calls as JSON objects. Verify balance before every trade. Max 10% balance per action.
You are FinanceBot, an autonomous financial agent running on Purple Flea.
Purple Flea financial infrastructure (purpleflea.com):
• Casino API: POST /api/casino/bet — provably fair crash, coinflip, dice
• Trading API: GET /api/trading/price/{symbol}, POST /api/trading/perp/order
• Wallet API: GET /api/wallet/balance, POST /api/wallet/send
• Domain API: POST /api/domains/register
• Faucet: POST https://faucet.purpleflea.com/claim (one-time $1 USDC)
• Escrow: POST https://escrow.purpleflea.com/create (agent payments)
When asked to perform financial actions, output:
{"action": "api_call", "endpoint": "...", "method": "GET|POST", "body": {...}}
Risk rules:
- Never risk more than 10% of balance on one action
- Always check balance first with GET /api/wallet/balance
- Crash game: target 1.5x–2.5x cashout multiplier
- Trading: max 3x leverage, set stop-loss at -15%
import json import requests from openai import OpenAI # Jan runs locally — no API key needed jan = OpenAI(base_url="http://localhost:1337/v1", api_key="jan") PF_KEY = "pf_live_your_key_here" PF_BASE = "https://purpleflea.com/api" pf = requests.Session() pf.headers["Authorization"] = f"Bearer {PF_KEY}" def execute_pf_action(action_json: dict) -> dict: """Execute a Purple Flea API call parsed from Jan's response.""" endpoint = action_json["endpoint"] method = action_json.get("method", "GET").upper() body = action_json.get("body", {}) # Handle special endpoints if "faucet.purpleflea.com" in endpoint: url = endpoint elif "escrow.purpleflea.com" in endpoint: url = endpoint else: url = f"{PF_BASE}{endpoint}" if method == "GET": r = pf.get(url, params=body) else: r = pf.post(url, json=body) return r.json() def run_jan_agent(task: str): """Run a financial task using Jan for reasoning.""" messages = [ { "role": "system", "content": """You are a financial agent on Purple Flea. Output API calls as: {"action": "api_call", "endpoint": "...", "method": "GET|POST", "body": {...}} When done, output: {"action": "done", "summary": "..."}""" }, {"role": "user", "content": task} ] for step in range(8): response = jan.chat.completions.create( model="mistral-7b-instruct", # or any Jan-loaded model messages=messages, temperature=0.2 ) content = response.choices[0].message.content messages.append({"role": "assistant", "content": content}) # Parse JSON from response try: parsed = json.loads(content) except json.JSONDecodeError: # Try to extract JSON block from text start = content.find("{") end = content.rfind("}") + 1 parsed = json.loads(content[start:end]) if start >= 0 else {} if parsed.get("action") == "done": print(f"\nAgent complete: {parsed['summary']}") break elif parsed.get("action") == "api_call": print(f" → {parsed['method']} {parsed['endpoint']}") result = execute_pf_action(parsed) print(f" ← {json.dumps(result)[:150]}") messages.append({"role": "user", "content": f"API result: {json.dumps(result)}"}) # Example usage run_jan_agent("Check my USDC balance, then claim the faucet if under $1, then place a $0.25 crash bet at 2x.")
Jan is one of several local LLM runtimes Purple Flea integrates with. Explore Ollama, LM Studio, and GPT4All integrations.
Jan keeps your agent's thinking local. Purple Flea handles the financial execution. Get started free with $1 USDC from the faucet.