> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getbindu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 2.3 Premium Advisor

> Paid agent with X402 payments (0.01 USDC per query)

Paid agent with X402 payments (0.01 USDC per query).

## Code

Create `premium-advisor.py` with the code below, or save it directly from your editor.

```python theme={null}
import os
from dotenv import load_dotenv
from bindu.penguin.bindufy import bindufy
from agno.agent import Agent
from agno.models.openrouter import OpenRouter

load_dotenv()

agent = Agent(
    instructions="""You are the Oracle of Value, a premium market insight advisor.
    Provide high-value, actionable market insights and investment recommendations.

    Your expertise includes:
    - Deep-chain analysis of blockchain projects
    - Market trend identification and forecasting
    - Risk assessment and safety analysis
    - Developer activity evaluation
    - Investment strategy guidance

    Always provide:
    1. Clear, actionable insights
    2. Risk assessments when relevant
    3. Specific recommendations with reasoning
    4. Market context and timing considerations

    Focus on premium, high-value insights that justify the cost. Be direct,
    confident, and provide specific, actionable advice.""",

    model=OpenRouter(
        id="openai/gpt-oss-120b",
        api_key=os.getenv("OPENROUTER_API_KEY")
    ),
)

def handler(messages: list[dict[str, str]]):
    if messages:
        latest_message = messages[-1].get('content', '') if isinstance(messages[-1], dict) else str(messages[-1])
        result = agent.run(input=latest_message)
        
        if hasattr(result, 'content'):
            return result.content
        elif hasattr(result, 'response'):
            return result.response
        else:
            return str(result)
    
    return "🔮 Welcome to Oracle of Value! Ask me about market insights, investment opportunities, or financial analysis. Premium insights require 0.01 USDC payment."

config = {
    "author": "premium.advisor@example.com",
    "name": "Oracle_of_Value",
    "description": "I provide high-value market insights and investment recommendations. Payment required upfront.",
    "deployment": {
        "url": "http://localhost:3773",
        "expose": True,
        "cors_origins": ["http://localhost:5173"]
    },
    "execution_cost": {
        "amount": "0.01",
        "token": "USDC",
        "network": "base-sepolia",
        "pay_to_address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    },
    "skills": ["skills/premium-market-insight-skill"],
    "storage": {"type": "memory"},
    "scheduler": {"type": "memory"},
    "debug_mode": True,
}

bindufy(config, handler)

#bindufy(config, handler, launch=True)
# This will create a tunnel to your agent and expose it on port 3773
```

## Skill Configuration

Create `skills/premium-market-insight-skill/skill.yaml`:

```yaml theme={null}
id: premium-market-insight-skill
name: premium-market-insight-skill
version: 1.0.0
author: premium.advisor@example.com
description: |
  Premium market insights and financial analysis agent that provides
  high-value investment recommendations and market analysis.

  Features:
  - Proprietary deep-chain analysis
  - Market trend identification
  - Risk assessment and recommendations
  - Developer activity analysis
  - Project audit verification
  - Investment strategy guidance

  Provides premium insights that require payment upfront through X402 protocol.
  All recommendations are based on thorough analysis of market conditions,
  project fundamentals, and developer activity.

  Payment Required: 0.01 USDC per interaction
tags:
  - finance
  - market-analysis
  - investment
  - cryptocurrency
  - blockchain
  - trading
  - premium
  - paid
input_modes:
  - application/json
output_modes:
  - application/json
examples:
  - "What are the best investment opportunities right now?"
  - "Analyze the current market trends"
  - "Should I invest in new DeFi projects?"
  - "What's your outlook for Bitcoin this month?"
  - "Which projects have strong developer activity?"
capabilities_detail:
  market_analysis:
    supported: true
    description: "Comprehensive market trend analysis and insights"
  investment_recommendations:
    supported: true
    description: "Data-driven investment recommendations and strategies"
  risk_assessment:
    supported: true
    description: "Project risk evaluation and safety analysis"
  developer_activity_tracking:
    supported: true
    description: "Analysis of developer activity and project fundamentals"
  payment_gated:
    supported: true
    description: "Premium service requiring X402 payment (0.01 USDC)"
```

## How It Works

**Premium Instructions**

* Defines expertise: blockchain analysis, market trends, risk assessment
* Structured output: insights, risk assessments, recommendations
* High-value focus to justify payment cost

**X402 Payment Gating**

* `execution_cost`: Payment configuration
* `amount`: 0.01 USDC per query
* `network`: base-sepolia (testnet)
* `pay_to_address`: Recipient wallet address
* Payment required before agent responds

**Handler**

* Protected by X402 paywall
* Only executes after payment confirmation
* Returns premium market insights

**Model**

* `openai/gpt-oss-120b`: Advanced financial reasoning
* Provides actionable investment advice

## Dependencies

```bash theme={null}
uv init
uv add bindu agno python-dotenv
```

## Environment Setup

Create `.env` file:

```bash theme={null}
OPENROUTER_API_KEY=your_openrouter_api_key_here
```

## Run

```bash theme={null}
uv run premium-advisor.py
```

**Examples:**

* "What are the best investment opportunities right now?"
* "Analyze the current market trends"
* "Should I invest in new DeFi projects?"

## Example API Calls

<AccordionGroup>
  <Accordion title="Message Send Request">
    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "method": "message/send",
      "params": {
        "message": {
          "role": "user",
          "kind": "message",
          "messageId": "9f11c870-5616-49ad-b187-d93cbb100001",
          "contextId": "9f11c870-5616-49ad-b187-d93cbb100002",
          "taskId": "9f11c870-5616-49ad-b187-d93cbb100003",
          "parts": [
            {
              "kind": "text",
              "text": "What are the best investment opportunities right now?"
            }
          ]
        },
         "skillId": "premium-market-insight-skill",
        "configuration": {
          "acceptedOutputModes": ["application/json"]
        }
      },
      "id": "9f11c870-5616-49ad-b187-d93cbb100003"
    }
    ```
  </Accordion>

  <Accordion title="Task get Request">
    ```json theme={null}
    {
      "jsonrpc": "2.0",
      "method": "tasks/get",
      "params": {
        "taskId": "9f11c870-5616-49ad-b187-d93cbb100003"
      },
      "id": "9f11c870-5616-49ad-b187-d93cbb100004"
    }
    ```
  </Accordion>
</AccordionGroup>

## Frontend Setup

```bash theme={null}
# Clone the Bindu repository
git clone https://github.com/GetBindu/Bindu

# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Start frontend development server
npm run dev
```

Open [http://localhost:5173](http://localhost:5173) and try to chat with the premium advisor
