x4ai

A modular, autonomous AI agent built on the x402 protocol. Designed for intelligent automation, decentralized computation, and agentic interoperability.

Entrypoints

Explore the capabilities exposed by this agent. Invoke with JSON, stream responses when available, and inspect pricing where monetization applies.

brainstorm

Invoke

Summarise a topic and suggest three follow-up ideas using AxFlow.

Pricing Invoke: 1000
Network base-sepolia
Invoke Endpoint POST /entrypoints/brainstorm/invoke
Input Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "topic": {
      "description": "High level topic to explore.",
      "type": "string",
      "minLength": 1
    }
  },
  "required": ["topic"],
  "additionalProperties": false
}
Output Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "summary": {
      "type": "string"
    },
    "ideas": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": ["summary", "ideas"],
  "additionalProperties": false
}
Invoke with curl
curl -s -X POST \
  'http://ax-flow-agent-production.up.railway.app/entrypoints/brainstorm/invoke' \
  -H 'Content-Type: application/json' \
  -d '
    {
      "input": {
        "topic": "string"
      }
    }
  '

dex-price

Invoke

Get the latest USD price for a token via Dexscreener (by address or search query).

Pricing Invoke: 1000
Network base-sepolia
Invoke Endpoint POST /entrypoints/dex-price/invoke
Input Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "tokenAddress": {
      "description": "EVM token contract address (0x...).",
      "type": "string",
      "pattern": "^0x[a-fA-F0-9]{40}$"
    },
    "query": {
      "description": "Free-text search (symbol/name/pair).",
      "type": "string"
    }
  },
  "additionalProperties": false
}
Output Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "priceUsd": {
      "description": "Price in USD for the selected pair.",
      "type": "number"
    },
    "chainId": {
      "type": "string"
    },
    "pairAddress": {
      "type": "string"
    },
    "dexId": {
      "type": "string"
    },
    "tokenSymbol": {
      "type": "string"
    },
    "baseTokenAddress": {
      "type": "string"
    },
    "url": {
      "type": "string"
    },
    "note": {
      "type": "string"
    }
  },
  "required": ["priceUsd"],
  "additionalProperties": false
}
Invoke with curl
curl -s -X POST \
  'http://ax-flow-agent-production.up.railway.app/entrypoints/dex-price/invoke' \
  -H 'Content-Type: application/json' \
  -d '
    {
      "input": {
        "tokenAddress": "string",
        "query": "string"
      }
    }
  '

Client Example: x402-fetch

Use the x402-fetch helpers to wrap a standard fetch call and automatically attach payments. This script loads configuration from .env, pays the facilitator, and logs both the response body and the decoded payment receipt.

import { config } from "dotenv";
import {
  decodeXPaymentResponse,
  wrapFetchWithPayment,
  createSigner,
  type Hex,
} from "x402-fetch";

config();

const privateKey = process.env.PRIVATE_KEY as Hex | string;
const baseURL = process.env.RESOURCE_SERVER_URL as string;
const endpointPath = process.env.ENDPOINT_PATH as string;
const url = `${baseURL}${endpointPath}`;

if (!baseURL || !privateKey || !endpointPath) {
  console.error("Missing required environment variables");
  process.exit(1);
}

async function main(): Promise<void> {
  const signer = await createSigner("base-sepolia", privateKey);
  const fetchWithPayment = wrapFetchWithPayment(fetch, signer);

  const response = await fetchWithPayment(url, { method: "GET" });
  const body = await response.json();
  console.log(body);

  const paymentResponse = decodeXPaymentResponse(
    response.headers.get("x-payment-response")!
  );
  console.log(paymentResponse);
}

main().catch((error) => {
  console.error(error?.response?.data?.error ?? error);
  process.exit(1);
});