Repository avatar
AI Tools
v1.0.0
active

edge-ai-x402

io.github.Drax3041-tech/edge-ai-x402

Pay-per-call Edge AI (Llama 3.3, GPT-OSS, FLUX, BGE-M3) & Markdown web extraction ($0.001+ x402).

Documentation

Edge AI x402 MCP

nohumans status

Ultra-low-cost pay-per-call AI inference, embeddings, FLUX image generation, and public URL-to-Markdown web extraction on Cloudflare Workers, settled on Solana Mainnet via x402 v2 (USDC & USDT via PayAI and Dexter facilitators) or prepaid credit key packs.

  • Production Base URL: https://edge-ai-x402.nguyenthanhnam-pye.workers.dev
  • Remote MCP Endpoint (Streamable HTTP): https://edge-ai-x402.nguyenthanhnam-pye.workers.dev/mcp
  • OpenAPI 3.1 Spec: https://edge-ai-x402.nguyenthanhnam-pye.workers.dev/openapi.json
  • x402 Manifest: https://edge-ai-x402.nguyenthanhnam-pye.workers.dev/.well-known/x402.json
  • MCP Server Card: https://edge-ai-x402.nguyenthanhnam-pye.workers.dev/.well-known/mcp/server-card.json
  • Dexter / x402gle Skills: https://x402gle.com/servers/edge-ai-x402.nguyenthanhnam-pye.workers.dev/skills.json
  • Settlement Network: Solana Mainnet (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp)
  • Accepted Assets: USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v), USDT (Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB)
  • Facilitators: PayAI (https://facilitator.payai.network) & Dexter (https://x402.dexter.cash)

Pricing & Endpoints

RouteMCP ToolModels / BehaviorPrice (USD)
GET /v1/modelslist_ai_modelsList available chat, embedding & image modelsFree
GET /v1/web/extract/sample—Static web extraction response exampleFree
POST /v1/chat/completionsai_chat_completionllama-3.3-70b, gpt-oss-20b, gemma-4-26b, qwen-coder-32b$0.001
POST /v1/embeddingsai_embeddingsbge-m3, bge-small, bge-large$0.001
POST /v1/web/extract (GET also supported)web_extract_markdownSSRF-guarded public URL HTML -> clean Markdown + headings/links$0.002
POST /v1/images/generateai_generate_imageflux-1-schnell (1-4 steps, JPEG base64)$0.005
POST /v1/keys/redeem—Redeem prepaid credit packs (starter_1 $1 / 1,200 cr, builder_5 $5 / 6,500 cr, pro_15 $15 / 25,000 cr)On-chain

Quick Start

1. Discover x402 v2 payment terms (HTTP 402)

curl -i -X POST https://edge-ai-x402.nguyenthanhnam-pye.workers.dev/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"llama-3.3-70b","messages":[{"role":"user","content":"Hello"}]}'

Decode the base64 PAYMENT-REQUIRED response header, sign the Solana Mainnet USDC or USDT transaction with an x402 v2 client, and retry with PAYMENT-SIGNATURE.

2. Connect via Remote MCP (Streamable HTTP)

{
  "mcpServers": {
    "edge-ai-x402": {
      "url": "https://edge-ai-x402.nguyenthanhnam-pye.workers.dev/mcp"
    }
  }
}

Security & Accounting

  • Strict x402 v2 Exact Settlement: Verifies facilitator proof and settles before running inference; atomic SQLite-backed Durable Object (EdgeLedger) prevents concurrent replay and enforces the daily neuron budget.
  • SSRF-Protected Web Extraction: Accepts public HTTP/HTTPS domains only; rejects IP literals, credentials, non-standard ports, loopback/private/internal/metadata hosts, and re-validates every redirect hop.

Local Development & Tests

node --test test/*.test.js

Copy wrangler.example.toml to wrangler.toml, provision your own KV namespaces and Solana wallet variables, and deploy with npx wrangler deploy.

License

MIT