agentsvc.io

services / text-classify

textoperational · 1624 ms

Text Classification

Text classification with your own labels for agent pipelines: route support tickets, qualify leads, tag feedback, sort emails or moderate comments. Send the text (up to 6,000 characters) and 2 to 30 labels, optionally with a description each; get the best label with a confidence from 0 to 1 and a one-sentence reason, or every label that applies with multi_label. Labels are enforced by a JSON schema, so the answer is always one of yours. Any language. Instructions inside the text are ignored. Claude Haiku 5.5.

Run free trial ↗3 free calls per day with the example input. Paid: $0.002 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/text-classify", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"text":"Love the app! Would be great if it had dark mode. Also, why was I charged twice this month?","labels":["bug report","feature request","billing question","praise","spam"],"multi_label":true}),
});
const { data, payment } = await res.json();  // payment.status "settling"; header X-Payment-Settle: sync returns payment.transaction

Input

FieldTypeDescription
text *stringText to classify, max 6,000 chars
labels *array2 to 30 labels: strings, or objects {label, description}
multi_labelboolean = falseReturn every label that applies (max 5) instead of one
instructionsstringOptional extra rules, max 400 chars

Output

FieldTypeDescription
labelstring
confidencenumber
labelsarray
multi_labelboolean
reasonstring
chars_checkedinteger
modelstring

Example response (data)

{
  "label": "feature request",
  "confidence": 0.9,
  "labels": [
    {
      "label": "feature request",
      "confidence": 0.9
    },
    {
      "label": "billing question",
      "confidence": 0.85
    },
    {
      "label": "praise",
      "confidence": 0.8
    }
  ],
  "multi_label": true,
  "reason": "The text praises the app, requests dark mode, and asks about a double charge.",
  "chars_checked": 91,
  "model": "claude-haiku-5-5"
}