Dify Integration

Purple Flea Tools for Dify

Import Purple Flea as a custom tool in Dify using a single OpenAPI schema URL. Your Dify AI agents gain crypto wallets, live perpetual trading, and provably fair casino games instantly.

LLM Apps Built Visually, Powered Financially

Dify.ai is an open-source LLM application development platform with a visual workflow builder at its core. Teams use Dify to compose RAG pipelines, chatbots, and autonomous AI agents without managing LLM infrastructure directly. Dify supports custom tools through its OpenAPI-compatible tool provider system — any API that publishes a valid OpenAPI 3.x specification can be imported and used by Dify agents in seconds.

Purple Flea publishes a complete, production-grade OpenAPI 3.1 schema at purpleflea.com/openapi. Paste that URL into Dify's custom tool import dialog and the full Purple Flea tool suite — wallets, trading, casino, domains, escrow, and faucet — appears immediately in Dify's tool palette, ready to be added to any workflow or agent.

🔌

One-URL Import

Dify's custom tool system accepts an OpenAPI schema URL directly. Enter https://purpleflea.com/openapi, confirm the tool list, add your API key, and every Purple Flea endpoint becomes available to your agents. No code changes, no package installs.

🗂️

Dify Marketplace Listing

Purple Flea is submitted to the Dify marketplace as a verified tool provider under the "Finance" category. If you are running Dify Cloud or a self-hosted instance with marketplace access enabled, you can install Purple Flea from the marketplace with a single click.

🔑

Secure Credential Storage

Dify stores your Purple Flea API key in its encrypted credential store. The key is injected as the X-PF-API-Key header on every outbound request. Your key is never exposed in workflow definitions or logs.

🌊

Workflow & Agent Modes

Purple Flea tools work in both Dify's Workflow mode (deterministic, node-based pipelines) and Agent mode (LLM-driven tool selection). In workflow mode you call specific tools explicitly; in agent mode the LLM decides which financial action to take based on context.

📡

Streaming Compatible

Dify supports streaming responses for LLM nodes. Purple Flea's API responses are compact JSON, so tool call latency is typically under 300ms — fast enough that streaming is never blocked waiting for a wallet balance or trade fill.

🤖

Multi-Agent Orchestration

Dify supports multi-agent pipelines where separate agents handle different tasks. Run a Trading Agent and a Risk Manager Agent in parallel, each calling Purple Flea independently, coordinating through Dify's shared memory nodes.

Import Purple Flea into Dify

The full integration takes under two minutes. No local dependencies to install.

1

Navigate to Dify's Tool Library

In your Dify instance (Cloud or self-hosted), go to the top navigation and select Tools. Click "Create Custom Tool" in the upper right.

2

Import the Purple Flea OpenAPI Schema

Select "Import from URL" and paste the schema URL. Dify will fetch and parse the schema automatically.

https://purpleflea.com/openapi
3

Set Your API Key

After import, Dify will prompt you for the tool's authentication credential. Select "API Key" auth type, set the header name to X-PF-API-Key, and paste your Purple Flea API key.

4

Add Tools to Your Agent or Workflow

Open any existing or new App in Dify. In the Tools panel, enable the Purple Flea tools you want available. In agent mode, the LLM will call them autonomously. In workflow mode, drag tool nodes onto the canvas and connect them explicitly.

5

Test with a Prompt

In the Dify Playground, try a prompt like: "Check my BTC balance and place a 0.001 BTC long on BTC-PERP at market price." Watch the agent call getBalance and placeOrder in sequence.

OpenAPI 3.1 Schema Preview

The full schema defines every endpoint, request/response shape, and authentication method. Dify renders tool descriptions from the summary and description fields — the LLM uses these to decide when to call each tool.

Each operation includes an x-dify-tool-description extension with a concise natural language description optimized for LLM reasoning. This ensures Dify agents route to the correct financial action even when the user's intent is expressed in casual language.

# purpleflea.com/openapi (excerpt) openapi: "3.1.0" info: title: "Purple Flea API" version: "1.0.0" description: "Financial infrastructure for AI agents" servers: - url: "https://purpleflea.com/api/v1" security: - ApiKeyAuth: [] paths: /wallet/balance: get: summary: "Get wallet balance" operationId: "getBalance" parameters: - name: "chain" in: "query" schema: type: "string" enum: ["BTC","ETH","SOL", "XMR","DOGE","TRX"]

What Your Dify Agent Can Do

Every Purple Flea capability is exposed as a discrete OpenAPI operation, discoverable by Dify's tool system.

getBalance — multi-chain wallet balance sendFunds — on-chain transfers receiveAddress — generate deposit address placeOrder — Hyperliquid perp trades getPositions — open positions + PnL cancelOrder — cancel open order rollDice — provably fair dice flipCoin — provably fair coin flip spinSlots — slot machine with multipliers registerDomain — 500+ TLDs createEscrow — trustless payment hold releaseEscrow — release to counterparty claimFaucet — free funds for new agents getMarkets — live market data, 275 perps

All operations are available in both Dify's Workflow node palette and Agent tool selector. In Workflow mode, each operation maps to a dedicated node with typed input/output fields. In Agent mode, the LLM receives the full list of tool descriptions and selects operations autonomously based on the task at hand. Dify renders tool call history in its Conversation debug view, so you can see exactly which Purple Flea endpoints your agent called and with what parameters.

Build Dify Apps. Earn Referral Income.

Every Purple Flea API key carries a referral code. Share your Dify app template — or publish it to the Dify community — and earn on every transaction other agents make through your referral.

20%
Casino house edge share
10%
Wallet transaction fees
10%
Hyperliquid trading fees
15%
Escrow service fees

Referral payouts are automatic and instantaneous — credited to your Purple Flea wallet balance as soon as a referred transaction settles. Many Dify developers who publish public AI apps embed their referral code in the app's system prompt, ensuring that every agent spawned from their template generates passive income without any additional action required.

Other Frameworks & Resources

Purple Flea integrates across the full AI agent ecosystem. Find your framework below.