HPSILab x402 Pay-Per-Call for AI Agents

    1

    Stop managing API keys and pre-paid credit balances for quant-finance tools.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    HPSILab x402 Pay-Per-Call for AI Agents

    Example session with this skill installed

    Show me how to set up a capped payment policy for the get_monte_carlo tool that limits spending to $0.20 per call and $5.00 per day.

    • Read your context and instructions
    • Compiled the hpsilab x402 pay-per-call

    I have configured the HPSILab x402 payment policy with your specified constraints. This setup ensures the agent can only pay for Monte Carlo simulations within the defined budget, using local signing to keep your private key secure.

    x402 Payment Policy Configuration

    from hpsilab_mcp import HpsiMcpClient, X402Wallet, PaymentPolicy
    
    # Initialize wallet with a safety cap for a single signature
    wallet = X402Wallet(max_price_usdc=0.20) 
    
    # Define strict spending limits and tool allowlist
    policy = PaymentPolicy(
        mode="x402_fallback",
        max_payment_per_call=0.20,
        max_payment_per_session=1.00,
        max_payment_per_day=5.00,
        allowed_payment_assets={"USDC"},
        allowed_networks={"base"},
        x402_allowed_tools={"get_monte_carlo"}
    )
    
    # Instantiate client - will only pay if HTTP 402 is received
    client = HpsiMcpClient(wallet=wallet, payment_policy=policy)
    
    # Example usage
    try:
        result = client.get_monte_carlo("TSLA")
        print(f"Spend summary: {client.payment_spend_summary()}")
    except Exception as e:
        print(f"Call failed: {e}")
    

    Next steps

    • Ensure HPSILAB_X402_PRIVATE_KEY is set in your environment variables.
    • Fund your Base wallet with a small amount of USDC to act as a float.
    • Verify the current price of the get_monte_carlo tool via the HPSILab credits catalog.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Stop managing API keys and pre-paid credit balances for quant-finance tools. This skill implements the x402 protocol to enable pay-per-call access to HPSILab stock and options research, letting your agents pay for individual requests in USDC on the Base network.

    What it does

    • Automates 402 recovery by detecting HTTP 402 Payment Required responses and signing challenges to retry requests.
    • Enforces spending caps with granular controls for per-call, per-session, and per-day limits in USD.
    • Secures private keys using local signing that keeps EVM private keys in the environment and out of logs or chat history.
    • Restricts tool access through a configurable allowlist to prevent agents from paying for unintended API calls.
    • Manages settlement risk by identifying unknown settlement states to prevent double-spending on retries.

    How it works

    1. Initialize the wallet by loading an EVM private key from the environment and setting a maximum price guard.
    2. Define a payment policy specifying the allowed assets, networks, spending limits, and tool allowlist.
    3. Configure the client with the wallet and policy to enable the x402_fallback mode.
    4. Execute research calls like Monte Carlo simulations or pre-trade risk scans which automatically pay only when quotas are exhausted.

    Frameworks & tools

    This skill uses the hpsilab-mcp Python SDK with the x402 extra for local signing. It operates on the Base blockchain using USDC.

    Why this beats prompting it yourself

    Manual prompting often fails to handle the complex state of a 402 challenge or risks leaking sensitive private keys in the chat context. This skill provides the specific error handling logic required to prevent catastrophic retry loops that could drain a wallet.

    Use cases

    • Anonymous research accessing Pro-tier quant data without creating an account or managing HPSILab credits.
    • Autonomous agents that need to self-fund their own data requirements for stock predictions or IV radar.
    • CI/CD pipelines that run occasional backtests without needing a permanent subscription.

    Known limitations

    A funded wallet does not top up an existing HPSILab account. It only works for anonymous callers without an API key. Settlement unknown errors require manual reconciliation and stop the payment path.

    Works only for anonymous calls without an API key. Requires a funded EVM wallet on Base with USDC. Settlement unknown errors require manual reset of the payment path.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 10 days ago

    Requires

    Hpsilab MCP

    Permissions

    Terminal / Shell
    Write Files
    Listed10 days ago

    What's inside

    Frequently Asked Questions

    This skill allows your AI agents to pay for HPSILab quant-finance data on a per-request basis using USDC, eliminating the need for expensive monthly subscriptions or pre-paid API credit management.

    It is built for Python-based agents using the hpsilab-mcp SDK and operates exclusively on the Base network using USDC for high-speed, low-cost transactions.

    Security is handled via local signing, meaning your EVM private keys stay in your local environment and are never transmitted to HPSILab or included in the AI's chat logs.

    You have granular control through the payment policy, which lets you set strict spending caps per call, per session, or per day to prevent runaway costs from agent loops.

    No, this skill is designed for anonymous, pay-as-you-go access; it does not interact with or top up existing HPSILab accounts or traditional credit balances.

    The purchase includes the core x402 payment logic, the local signing implementation, and the configuration templates needed to integrate with the hpsilab-mcp Python SDK.

    New in LLM Ops