✨ Agent API

AI agents pay AI agents.

GapSmith's venture intelligence is callable by other AI agents over standard HTTPS. Pay per call with USDC on Solana via the x402 protocol — no API keys, no signups, no chargebacks. Settlement in ~2 seconds.

Quickstart

Five-line Python — agent pays 0.10 USDC, gets the latest market gaps for an AI/ML sector:

# pip install solana solders requests
from agent_demo import x402_get  # see examples/agent_demo.py

resp = x402_get("https://gapsmith.draftlabs.org/api/v1/scout/gaps?sector=ai-ml",
                wallet_secret_key=YOUR_PRIVATE_KEY_BYTES)
print(resp.json())  # → { gaps: [...], count: N, generatedFrom: "2026-..." }

Reference implementation: agent_demo.py — self-contained, ~150 lines. Request a copy at /contact.

What model runs your call

All /api/v1/* endpoints run on a cost-effective LLM tier(MiniMax M2.7 / Claude Sonnet 4.6 class). That's what makes per-call pricing in the $0.05–$15 range sustainable — we're not running every probe on Opus 4.7.

Why this design
  • Quality stays high — Sonnet 4.6 / MiniMax M2.7 produce venture-grade Scout output (verified at parity with Opus on the same Scout brief).
  • Pricing stays predictable — agent operators can budget per-call cost without worrying about which model rolled the dice today.
  • Latency stays low — sync endpoints settle in seconds; the async Compute API ( /forge/ideate) returns within ~30 min.

Need top-tier output? The Done-For-You service runs the same pipelines on Claude Opus 4.7 / GPT-5.5 Pro with human review. Slower and pricier ($39 / $99 / $149 per run, 24-72 hours), but built for the moments where you ship the report to a customer or investor.

The x402 flow

Three round trips — but the second is on-chain, not HTTP:

  1. Probe: Agent makes the request without payment. Server returns HTTP 402 Payment Required with a JSON body listing acceptable payment options (recipient, amount, mint, network).
  2. Settle: Agent constructs an SPL transferChecked instruction sending the required USDC to our merchant ATA, signs with its own Solana wallet, and submits to the network. Wait for confirmation (~2s).
  3. Redeem: Agent retries the same request with X-PAYMENT header containing the transaction signature. Server verifies on-chain, then returns the resource.

402 response body

HTTP/1.1 402 Payment Required
Content-Type: application/json
x402-version: 1

{
  "x402Version": 1,
  "accepts": [{
    "scheme": "exact",
    "network": "solana",
    "maxAmountRequired": "100000",        // atomic units (USDC has 6 decimals)
    "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "payTo": "DtESM4kaLx6Kjxz5oTKwv4AxkkEbsphHcMJXV4ShRrZ5",
    "resource": "https://gapsmith.draftlabs.org/api/v1/scout/gaps?sector=ai-ml",
    "description": "Scout market gap intelligence — aggregated from recent multi-agent scans",
    "mimeType": "application/json",
    "maxTimeoutSeconds": 60
  }],
  "error": "Payment required..."
}

X-PAYMENT header format

Base64-encoded JSON. Raw JSON also accepted (for ergonomic curl testing).

{
  "x402Version": 1,
  "scheme": "exact",
  "network": "solana",      // or "solana-devnet"
  "payload": {
    "txSignature": "<base58-encoded tx signature>"
  }
}

Devnet for testing

Append ?network=devnet to any endpoint URL to negotiate payment in devnet USDC instead of mainnet. The 402 response will include the devnet USDC mint, devnet merchant ATA, and the X-PAYMENT must reference a devnet tx. Mainnet is the default (no param needed) for production agent traffic.

# Test for free with devnet USDC (faucet.circle.com)
curl -i "https://gapsmith.draftlabs.org/api/v1/scout/gaps?sector=ai-ml&network=devnet"

# Switch to mainnet for real agents (default)
curl -i "https://gapsmith.draftlabs.org/api/v1/scout/gaps?sector=ai-ml"

Idempotency

  • Same tx_hash on the same endpoint → returns cached response (sync) or 409 (async)
  • Same tx_hash on a different endpoint → 400 rejection (proof was for another resource)
  • Wrong amount → 400 amount mismatch
  • Wrong mint (e.g. USDT instead of USDC) → 400 mint mismatch

Testing on devnet (no real USDC)

Production calls to /api/v1/* default to Solana mainnet — settlement is real USDC. For integration testing without burning funds, append ?network=devnet to the request URL. The server then advertises devnet USDC mint + a devnet merchant ATA in its 402 response, and verifies the signed tx on Solana devnet.

# Probe → 402 advertising devnet USDC mint + devnet merchant ATA
curl -i 'https://gapsmith.draftlabs.org/api/v1/scout/gaps?sector=ai-ml&network=devnet'

# 402 body (abridged):
# {
#   "accepts": [{
#     "network": "solana-devnet",
#     "asset": "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",   ← devnet USDC mint
#     "payTo": "<devnet merchant ATA>",
#     "maxAmountRequired": "100000"   // 0.10 USDC, atomic
#   }]
# }

# Fund a devnet wallet:
#   SOL:  https://faucet.solana.com (request 1 SOL)
#   USDC: https://faucet.circle.com (request a few USDC on Solana devnet)
# then sign + submit a transferChecked tx to the advertised ATA, retry with X-PAYMENT.

examples/agent_demo.py runs on devnet by default — pass --mainnetwhen you're ready to settle in real USDC. The exact same code path runs in both modes; only the network query parameter, mint, and merchant ATA differ.

Endpoints

Data API · synchronous · cache-only

Pre-aggregated market intelligence from recent Scout runs. Returns in <1 second. Ideal for AI agents querying market data at scale.

GET/api/v1/scout/gaps0.10 USDCMarket gap intelligence
GET/api/v1/scout/pain-clusters0.10 USDCPain themes from real complaints
GET/api/v1/scout/trends0.10 USDCEmerging market signals
GET/api/v1/scout/keywords0.05 USDCTop keywords by occurrence

All accept ?sector= filter and ?limit= cap. /trends also takes ?days=.

Discovery — call free first

GET/api/v1/sectorsfreeList which sectors have cached data (call before paid endpoints)

Data API responses are filtered from cached Scout runs. If you query ?sector=fintech but only ai-ml + healthtechare cached, you'll pay USDC and get an empty array. Hit /api/v1/sectorsfirst (free) to see what's available.

Compute API · async · runs full pipeline

Triggers a real multi-agent pipeline. Returns 202 Accepted + jobId immediately; agent polls /api/v1/jobs/{id} until completion or supplies a webhook_url for push delivery.

POST/api/v1/forge/ideate15 USDCRun a 5-round multi-agent brainstorm (~30 min)
POST/api/v1/prove/debate25 USDCRun a 6-persona adversarial debate against one idea (~60 min)

Job management · free

GET/api/v1/jobs/{jobId}freePoll async job status

Free because jobId already encodes the capability — knowing the id implies you paid for it.

Async job pattern

Compute API endpoints can take 10-45 minutes. We don't hold an HTTP connection that long — instead:

# 1. Pay + dispatch
resp = x402_post("https://.../api/v1/forge/ideate", body={
    "sectors": ["ai-ml"],
    "context": "Find SaaS gaps in agent observability tooling",
    # Optional: calibrate to your real constraints. Pass either a structured
    # object (preferred — enums caught by zod) or raw SESSION_CONFIG.md.
    # Without it the engine falls back to default Small Team / $10K / 4-8 weeks / $100K.
    "session_config": {
        "profile": "Solo",                # Solo | Small Team (2-3) | Small Team (4-5) | Funded Team (6-15) | Enterprise
        "budget": "$1K",                  # $1K | $5K | $10K | $25K | $50K | $100K+
        "timeline": "3-6 months",         # 2 weeks | 4 weeks | 4-8 weeks | 8-12 weeks | 3-6 months
        "revenue_threshold": "$50K/year", # $10K/year | $50K/year | $100K/year | $500K/year | $1M+/year
        "founder_signal": "8 years payments infra, ex-Stripe."
    },
    "webhook_url": "https://my-agent.com/forge-callback"   # optional
})
# resp.status_code == 202
job = resp.json()
# { "jobId": "fg_abc123", "statusUrl": "/api/v1/jobs/fg_abc123", "etaMinutes": 35 }

# 2. Poll (free, no payment needed)
import time
while True:
    s = requests.get(f"https://gapsmith.draftlabs.org/api/v1/jobs/{job['jobId']}").json()
    if s["status"] == "completed":
        print(s["result"])
        break
    if s["status"] == "failed":
        raise RuntimeError(s["error"])
    time.sleep(60)

# 3. (Optional) Webhook delivery
# If you set webhook_url, we POST to it with HMAC-signed body.
# Header: x-gapsmith-signature: <hex(hmac_sha256(secret, body))>
# Body: { "jobId": "fg_abc123", "status": "completed", "result": {...} }

Job statuses

StatusMeaning
pendingPayment verified, awaiting dispatch (usually <5s)
runningPipeline executing. Check progressPct for ETA
completedResult populated in result field
failedError in error field. Refunds via support.

Why x402 + Solana?

  • Stable pricing — USDC is 1:1 with USD, no FX or volatility. 0.10 USDC always means $0.10.
  • Sub-cent settlement fees— Solana network fees are ~0.000005 SOL (<$0.001 at typical SOL prices). The whole API economics rely on Solana's low fees being lower than the smallest amount worth charging.
  • Standard HTTP semantics — Nothing custom. Any HTTP client, any language, can call this API. No SDK lock-in.
  • No chargebacks— On-chain settlement is final. Agents can spend confidently, sellers don't deal with disputes.
  • Designed for autonomous agents— No signup, no account, no API key rotation. The agent's own wallet IS its identity. Coinbase and Anthropic explicitly designed x402 for this use case.

Building an agent? Request the agent_demo.py reference implementation via /contact. Questions: gapsmith@draftlabs.org.

← Back to GapSmith · Pricing · Merchant wallet ↗