VAPI INTEGRATION

Purple Flea for Vapi

Vapi is the leading voice AI platform for developers. Combined with Purple Flea's financial API, your Vapi agents can execute trades, check portfolio balance, and manage crypto wallets — all through voice commands. "Hey agent, check my BTC balance" executes instantly.

Get API Key Free Open Vapi →

Architecture

How Voice Finance Works

The complete flow from voice command to financial execution — in under two seconds.

1

Define Tools in Vapi Config

Register Purple Flea API endpoints as Vapi function tools in your assistant configuration. Each tool has a name, description, and parameter schema — Vapi uses these to decide when and how to call the API during conversation.

2

Speech to Tool Call

User speaks a command. Vapi transcribes the audio in real-time, routes it through the configured LLM (GPT-4, Claude, etc.) with your tool definitions, and the model decides which tool to call with what parameters.

3

Execute and Speak Result

Vapi calls your Purple Flea server-side function with the extracted parameters. Purple Flea executes the trade/balance check/wallet operation and returns a result. Vapi converts the result to speech and responds to the user.


Code

Tool Definition

Vapi assistant configuration with Purple Flea tools defined as callable functions.

Vapi Assistant Config — purple_flea_tools.json
{
  "name": "Purple Flea Financial Assistant",
  "voice": { "provider": "11labs", "voiceId": "paula" },
  "model": {
    "provider": "openai",
    "model": "gpt-4o",
    "systemPrompt": "You are a financial AI assistant with access to Purple Flea's crypto infrastructure. You can trade perpetual futures, check wallet balances, place casino bets, and manage escrow payments. Always confirm trade sizes above $500 before executing.",
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_portfolio",
          "description": "Get the agent's current portfolio: open positions, total PnL, and unrealized gains",
          "parameters": {
            "type": "object",
            "properties": {},
            "required": []
          }
        },
        "server": {
          "url": "https://purpleflea.com/api/portfolio",
          "secret": "YOUR_WEBHOOK_SECRET"
        }
      },
      {
        "type": "function",
        "function": {
          "name": "open_trade",
          "description": "Open a leveraged perpetual futures position on a crypto asset",
          "parameters": {
            "type": "object",
            "properties": {
              "symbol": {
                "type": "string",
                "description": "Trading pair, e.g. ETH-USD-PERP or BTC-USD-PERP"
              },
              "side": {
                "type": "string",
                "enum": ["buy", "sell"],
                "description": "Direction: buy for long, sell for short"
              },
              "size_usd": {
                "type": "number",
                "description": "Position size in USD notional value"
              },
              "leverage": {
                "type": "integer",
                "description": "Leverage multiplier between 1 and 50",
                "default": 1
              }
            },
            "required": ["symbol", "side", "size_usd"]
          }
        },
        "server": {
          "url": "https://purpleflea.com/api/trade",
          "secret": "YOUR_WEBHOOK_SECRET"
        }
      },
      {
        "type": "function",
        "function": {
          "name": "wallet_balance",
          "description": "Check the current balance of the crypto wallet for a specific blockchain",
          "parameters": {
            "type": "object",
            "properties": {
              "chain": {
                "type": "string",
                "enum": ["eth", "sol", "btc", "trx", "xmr", "ton"],
                "description": "Blockchain network to query"
              }
            },
            "required": ["chain"]
          }
        },
        "server": {
          "url": "https://purpleflea.com/api/wallet/balance",
          "secret": "YOUR_WEBHOOK_SECRET"
        }
      },
      {
        "type": "function",
        "function": {
          "name": "create_escrow",
          "description": "Create a new escrow payment locked until conditions are met",
          "parameters": {
            "type": "object",
            "properties": {
              "amount_usdc": {
                "type": "number",
                "description": "Amount of USDC to lock in escrow"
              },
              "recipient": {
                "type": "string",
                "description": "Wallet address or agent ID of the payment recipient"
              },
              "description": {
                "type": "string",
                "description": "Human-readable description of escrow conditions"
              }
            },
            "required": ["amount_usdc", "recipient"]
          }
        },
        "server": {
          "url": "https://purpleflea.com/api/escrow/create",
          "secret": "YOUR_WEBHOOK_SECRET"
        }
      }
    ]
  },
  "firstMessage": "Hello! I'm your Purple Flea financial assistant. I can check your portfolio, open trades, query wallet balances, and create escrow payments. What would you like to do?",
  "serverUrl": "https://your-server.com/vapi-webhook"
}

Examples

Voice Command Examples

Natural language commands your users can speak, mapped to the Purple Flea API calls they trigger.


Products

Available Financial Tools

Six Purple Flea APIs ready to be wired as Vapi function tools for voice-activated finance.

🎰
Casino

Casino API

Docs → "Place a $10 crash bet." Provably fair games via voice command.

📈
Trading

Trading API

Docs → "Short SOL with 5x leverage." 275 perpetual markets, voice-executed.

👛
Wallet

Wallet API

Docs → "What's my Bitcoin balance?" 6-chain wallet via voice query.

🌐
Domains

Domains API

Docs → "Register agentfi.io." Domain portfolio managed by voice.

🚰
Free

Faucet API

Docs → "Claim my free USDC." Zero-risk voice-triggered casino entry.

🔒
1% fee

Escrow API

Docs → "Lock 200 USDC for the project." Voice-activated escrow creation.


Use Cases

Voice Finance Use Cases

Real-world applications of Vapi + Purple Flea across trading, monitoring, and payments.

🗣️
Trading

Voice Trading Terminal

A hands-free trading desk: call out positions, hear market updates, and execute trades in perpetual futures — all while your hands are occupied. Ideal for mobile traders and accessibility use cases.

📊
Monitoring

Hands-Free Portfolio Monitor

Ask "How am I doing today?" and hear a spoken summary of your PnL, open positions, and largest movers — while driving, exercising, or away from a screen. Schedule daily voice briefings.

🔒
Payments

Voice-Activated Escrow

Coordinate agent-to-agent payments by voice: "Lock 500 USDC for the data labeling task." When the task completes, say "Release the escrow" — trustless execution without touching a keyboard.

📱
Mobile

Phone-Based Wallet Manager

Turn any phone call into a crypto wallet interface. Check balances, initiate sends, and confirm transactions by voice — with Vapi handling the speech layer and Purple Flea handling the execution.


Best Practices

Voice UX Tips

Design principles for voice-controlled financial agents — where clarity and safety are critical.


Get Started

Build Your Voice Financial Agent

Get a Purple Flea API key, paste the tool definition into your Vapi assistant config, and make your first voice-activated trade in under 20 minutes.

Get API Key Claim Free USDC →