API
Reference

Stream DeFi analytics and set up on-chain alerts with pay-per-use x402 payments. No API key needed.

api.nacian.appx402 Protocol

Authentication via x402

No API keys, no accounts. Every request is paid for individually with USDC on Base using the x402 payment protocol.

How it works

  1. 1Send your request to the endpoint.
  2. 2Receive a 402 Payment Required response with the exact price.
  3. 3Re-send the request with the x402 payment header attached.
POST/query

Stream a DeFi analytics response. The AI queries on-chain data in real time and streams the answer as NDJSON.

Request body

messagesrequired
array
Array of message objects. Each has a role ("user") and content (string).
model
string
Model to use: deepseek3.2 (default), minimax-2.5, or gemini-3-flash.
maxOutputTokens
number
Maximum output tokens. Range: 1500–5000. Default: 1500.
Example request
{
  "messages": [
    {
      "role": "user",
      "content": "What are the top 5 Uniswap V3 pools on Ethereum by TVL?"
    }
  ],
  "model": "deepseek3.2",
  "maxOutputTokens": 2000
}

Response format

The response is an NDJSON stream. Each line is a JSON object with a type field:

content
event
Streamed answer text. Concatenate all content events to build the full response.
tool-status
event
Emitted when the AI calls a data tool. Includes tool name and status ("running" or "complete").
error
event
Error or output-limit notice. Check this for failures.
Example with curl
curl -X POST https://api.nacian.app/query \
  -H "Content-Type: application/json" \
  -H "X-PAYMENT: <x402-payment-header>" \
  -d '{
    "messages": [{"role": "user", "content": "TVL of Aave V3 on Base"}]
  }'
POST/alert

Create a monitored alert. The AI interprets your condition, sets up polling, and sends a webhook when triggered.

Request body

messagesrequired
array
Array of message objects describing the alert condition. Each has a role ("user") and content (string).
webhookUrlrequired
string
URL to receive a POST request when the alert triggers.
model
string
Model to use: deepseek3.2 (default), minimax-2.5, or gemini-3-flash.
maxOutputTokens
number
Maximum output tokens. Range: 1500–5000. Default: 1500.
maxMinutes
number
How long to monitor before expiring. Range: 5–10080 (7 days). Default: 5.
frequencySeconds
number
Polling interval in seconds. Range: 30–86400. Default: 300.
Example request
{
  "messages": [
    {
      "role": "user",
      "content": "Alert me when ETH/USDC pool TVL on Uniswap V3 Ethereum drops below $100M"
    }
  ],
  "webhookUrl": "https://your-app.com/webhook",
  "maxMinutes": 1440,
  "frequencySeconds": 300
}

Response format

Same NDJSON stream as /query, plus an additional event type:

alert-created
event
Confirmation that the alert was successfully created with its monitoring parameters.
content
event
Streamed text explaining the alert setup.
tool-status
event
Tool call progress updates.
error
event
Error or validation failure.
Example response stream
{"type":"tool-status","tool":"queryGraph","status":"running","display":"Querying Uniswap V3..."}
{"type":"tool-status","tool":"queryGraph","status":"complete","display":"Query complete"}
{"type":"alert-created","alertId":"abc123","condition":"ETH/USDC TVL < $100M"}
{"type":"content","text":"Alert created. Monitoring ETH/USDC pool TVL on Uniswap V3..."}

API Pricing

Dynamic per-request pricing based on model, input size, and requested output tokens.

deepseek3.2
Base fee$0.010
Input / 150 chars$0.0001
Output / 150 tokens$0.00009
minimax-2.5
Base fee$0.0175
Input / 150 chars$0.00015
Output / 150 tokens$0.0003
gemini-3-flash
Base fee$0.0375
Input / 150 chars$0.0002
Output / 150 tokens$0.00075

Alert polling: ~$0.000026 per poll. Total alert cost = query cost + (number of polls x poll cost). Polls = maxMinutes * 60 / frequencySeconds.

price = baseFee + ceil(inputChars / 150) * inputCost + ceil(maxOutputTokens / 150) * outputCost

Protocol Coverage

Chains

  • Ethereum
  • Base
  • Arbitrum

Spot DEXes

  • Uniswap
  • Pancakeswap
  • Aerodrome
  • Sushiswap
  • Camelot
  • Quickswap

Lending

  • Aave
  • Compound

Infrastructure

  • ENS

Liquid Staking

  • Lido

For full version details, see the coverage page.

Network Data Coverage

Coming soon

Network data queries — including gas prices, block statistics, ETH price, and chain-level metrics — are not yet available through the API. This feature is currently exclusive to the chat interface and will be added to the API in a future release.

Onchain Data Coverage

Coming soon

Onchain data queries — including reading any public smart contract function and setting alerts on any returned value — are not yet available through the API. This feature is currently exclusive to the chat interface and will be added to the API in a future release.

Ready to Integrate?

Start making requests with x402 payments. No sign-up required.