x402 nativeFree demo

Phone fraud detection for AI agents

Copy-paste recipes for plugging Trust Engine into your agent. Returns a 0–100 trust score, risk flags, and a safe/warning/high_risk decision for any phone number — in under 200ms.

Free demo
/api/demo
Paid
$0.01 USDC · Base
Latency
<200ms
Tool name
get_trust_score
OpenAIAnthropicLangChainVercel AI SDKx402 (paid)
OpenAI

OpenAI function calling

Drop-in tool definition for chat.completions with tool_choice. Works with GPT-4o, GPT-4o-mini, GPT-5, and any function-calling-capable model.

python
from openai import OpenAI
import requests

client = OpenAI()

TOOLS = [{
    "type": "function",
    "function": {
        "name": "get_trust_score",
        "description": "Evaluate whether a phone number is a scam, spam, or safe. Returns a 0-100 trust score, risk flags, and a decision.",
        "parameters": {
            "type": "object",
            "required": ["phone_number"],
            "properties": {
                "phone_number": {"type": "string", "description": "Phone number in E.164, e.g. +15551234567"}
            },
        },
    },
}]

def get_trust_score(phone_number: str):
    r = requests.post(
        "https://trustscore.dev/api/demo",  # free demo; swap to /api/score for paid
        json={"type": "phone", "input": {"phone_number": phone_number}},
        timeout=10,
    )
    return r.json()

# Then in your chat loop: call client.chat.completions.create(tools=TOOLS, ...)
# and dispatch tool_calls to get_trust_score.
typescript
import OpenAI from "openai";
const openai = new OpenAI();

const tools = [{
  type: "function",
  function: {
    name: "get_trust_score",
    description: "Evaluate whether a phone number is a scam, spam, or safe. Returns a 0-100 trust score, risk flags, and a decision.",
    parameters: {
      type: "object",
      required: ["phone_number"],
      properties: {
        phone_number: { type: "string", description: "E.164, e.g. +15551234567" },
      },
    },
  },
}];

async function getTrustScore(phone_number) {
  const r = await fetch("https://trustscore.dev/api/demo", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ type: "phone", input: { phone_number } }),
  });
  return r.json();
}
Anthropic

Anthropic tool use

Claude Opus, Sonnet, and Haiku all natively support this tool schema. Swap /api/demo for /api/score to pay per call.

python
import anthropic, requests

client = anthropic.Anthropic()

TOOLS = [{
    "name": "get_trust_score",
    "description": "Evaluate whether a phone number is a scam, spam, or safe. Returns trust score (0-100), risk flags, and decision.",
    "input_schema": {
        "type": "object",
        "required": ["phone_number"],
        "properties": {
            "phone_number": {"type": "string", "description": "E.164, e.g. +15551234567"}
        },
    },
}]

def dispatch(tool_name: str, tool_input: dict):
    if tool_name == "get_trust_score":
        r = requests.post(
            "https://trustscore.dev/api/demo",
            json={"type": "phone", "input": {"phone_number": tool_input["phone_number"]}},
            timeout=10,
        )
        return r.json()
LangChain

LangChain & LangChain.js

StructuredTool / DynamicStructuredTool — pass straight into any LangChain or LangGraph agent.

python
from langchain.tools import StructuredTool
from pydantic import BaseModel, Field
import requests

class TrustScoreInput(BaseModel):
    phone_number: str = Field(description="Phone number in E.164, e.g. +15551234567")

def check_phone(phone_number: str) -> dict:
    r = requests.post(
        "https://trustscore.dev/api/demo",
        json={"type": "phone", "input": {"phone_number": phone_number}},
        timeout=10,
    )
    return r.json()

trust_score = StructuredTool.from_function(
    func=check_phone,
    name="get_trust_score",
    description="Check if a phone number is a scam, spam, or safe. Returns trust score, risk flags, and decision.",
    args_schema=TrustScoreInput,
)

# Pass [trust_score] to any LangChain/LangGraph agent.
typescript
import { DynamicStructuredTool } from "@langchain/core/tools";
import { z } from "zod";

export const trustScoreTool = new DynamicStructuredTool({
  name: "get_trust_score",
  description: "Check if a phone number is a scam, spam, or safe. Returns trust score, risk flags, and decision.",
  schema: z.object({
    phone_number: z.string().describe("E.164, e.g. +15551234567"),
  }),
  func: async ({ phone_number }) => {
    const r = await fetch("https://trustscore.dev/api/demo", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ type: "phone", input: { phone_number } }),
    });
    return JSON.stringify(await r.json());
  },
});
Vercel AI SDK

Vercel AI SDK

Zod-validated tool definition. Works with generateText, streamText, and multi-step agents.

typescript
import { tool } from "ai";
import { z } from "zod";

export const trustScore = tool({
  description: "Check if a phone number is a scam, spam, or safe. Returns trust score, risk flags, and decision.",
  parameters: z.object({
    phone_number: z.string().describe("E.164, e.g. +15551234567"),
  }),
  execute: async ({ phone_number }) => {
    const r = await fetch("https://trustscore.dev/api/demo", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ type: "phone", input: { phone_number } }),
    });
    return r.json();
  },
});

// Then: generateText({ model, tools: { trustScore }, ... })
x402

Pay per call with x402

Agent wallets can settle Trust Engine calls natively. $0.01 USDC per /api/score, $0.30 per /api/batch-score. Listed in the Coinbase x402 bazaar under category: identity.

bash
# Using the awal CLI to make a paid call
npx awal https://trustscore.dev/api/score \
  --method POST \
  --body '{"type":"phone","input":{"phone_number":"+15551234567"}}'

# Price: $0.01 USDC on Base (eip155:8453)
# Your agent wallet settles automatically.

# Or use any x402-aware client (x402-fetch, x402-axios).

Ship an integration?

Open an issue or reach out — we'll feature well-built integrations here.

eric@sparkengineering.co
Trust Engine — Spark Engineering
API docsOpenAPIllms.txt