Getting Started
Installation
npm install @queryflow-402/sdk
# or
pnpm add @queryflow-402/sdk
# or
yarn add @queryflow-402/sdk
Prerequisites
- Node.js 18+ (for native fetch support)
- A crypto wallet private key (for signing/payments)
- Testnet AVAX (for real payment mode)
Quick Start
1. Initialize the Client
import { QueryFlowClient } from "@queryflow-402/sdk";
// Use your wallet private key
const client = new QueryFlowClient(process.env.PRIVATE_KEY);
2. Make a Query
const result = await client.market({
assets: ["BTC", "ETH"],
timeframe: "24h",
});
console.log(result.sentiment);
// { score: 72, trend: "bullish", summary: "..." }
3. Handle the Response
All query methods return typed responses:
// Market sentiment
result.sentiment.score; // 0-100
result.sentiment.trend; // "bullish" | "bearish" | "neutral"
result.factors; // Key market factors
Payment Flow
- Your query is sent to the API
- API returns
402 Payment Requiredwith price - SDK automatically signs/sends payment
- API returns the AI insights
In signature mode (default), no real payment is made — perfect for development.
Next Steps
- Core Concepts — Learn about x402 and pay-per-query
- Payment Modes — Configure real payments
- API Reference — Full method documentation