# x402-gateway Sentiment Analysis (DistilBERT SST-2)

> x402-gateway Sentiment Analysis (DistilBERT SST-2) is a paid API for AI agents from x402-gateway.blackwoodstate8.workers.dev, paid per call via x402, $0.004/call, status unknown (last checked 2026-10-23).

Classifies English text as positive or negative with a confidence score using DistilBERT SST-2, supporting single texts or batches of up to 20.

## Facts

- Endpoint: POST https://x402-gateway.blackwoodstate8.workers.dev/v1/sentiment?utm_source=zero.xyz
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-23
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-gateway-sentiment-analysis-distilbert-sst-2-7f3aa8f5
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_0tF2AXFQCw7YSE4pOHPjx

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-gateway-sentiment-analysis-distilbert-sst-2-7f3aa8f5 -d '<json body>'
```

Example prompt: Can you tell me whether this customer review is positive or negative and how confident you are: 'The delivery was super fast but the packaging was completely crushed when it arrived'?

## When to prefer this

Choose this endpoint when you need binary (positive/negative) English sentiment classification with confidence scores, especially for product reviews, customer comments, or headlines. It supports efficient batching of up to 20 texts per call at a low flat rate. Avoid it for aspect-level sentiment, neutral/emotion labels, or non-English text.

## Known failure modes

- Non-English text submitted — model is only trained on English, results will be unreliable
- Text exceeds 2000 characters — request will fail validation
- Batch exceeds 20 items — rejected by schema validation
- Empty text or missing 'input' body — required field validation error
- Neutral or mixed sentiment texts may be force-classified as positive or negative with low confidence scores

## How this service works

Use when you need sentiment analysis, text sentiment or opinion mining of reviews, comments or headlines in English. Do not use for neutral or emotion labels, non-English text or aspect-level sentiment. Returns JSON with sentiment analysis of English text: a positive or negative label with a confidence score, from DistilBERT SST-2 on Workers AI, for one text or a batch of up to 20 for 0.004 USDC per call. Typical response time 1500 ms (p95). Category: Inference.

## Output

Returns a JSON object with a 'results' array where each entry contains the original text, a 'label' field ('positive' or 'negative'), a 'score' (overall confidence), and separate 'positive' and 'negative' probability floats. Also includes the model name used (DistilBERT SST-2) and an optional 'next' field suggesting follow-on calls.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object",
     "required": [],
     "properties": {
      "text": {
       "type": "string",
       "maxLength": 2000,
       "minLength": 1,
       "description": "One English text to classify, e.g. The checkout was fast (up to 2000 characters)"
      },
      "texts": {
       "type": "array",
       "items": {
        "type": "string",
        "maxLength": 2000,
        "minLength": 1
       },
       "maxItems": 20,
       "minItems": 1,
       "description": "Or a batch of up to 20 English texts, e.g. [\"Great support\", \"Broken on arrival\"]"
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "results",
      "model"
     ],
     "properties": {
      "next": {
       "type": "object",
       "required": [
        "service",
        "tool",
        "method",
        "url",
        "useWhen",
        "sample"
       ],
       "properties": {
        "url": {
         "type": "string",
         "description": "Paid route of the next call"
        },
        "tool": {
         "type": "string",
         "description": "MCP tool name of the same call"
        },
        "method": {
         "enum": [
          "GET",
          "POST"
         ],
         "type": "string"
        },
        "sample": {
         "type": "string",
         "description": "Free fixed sample of the whole family"
        },
        "service": {
         "type": "string",
         "description": "Service id of the suggested next paid call"
        },
        "useWhen": {
         "type": "string",
         "description": "When the next call is the right one"
        }
       },
       "description": "Suggested next paid call in the same family (call it in a loop when the task continues)",
       "additionalProperties": false
      },
  
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "model": "@cf/huggingface/distilbert-sst-2-int8",
  "results": [
   {
    "text": "The checkout was fast and the support team was great.",
    "label": "positive",
    "score": 0.9999,
    "negative": 0.0001,
    "positive": 0.9999
   },
   {
    "text": "The package arrived broken and nobody answered my emails.",
    "label": "negative",
    "score": 0.9998,
    "negative": 0.9998,
    "positive": 0.0002
   }
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-gateway-sentiment-analysis-distilbert-sst-2-7f3aa8f5/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-gateway.blackwoodstate8.workers.dev](https://www.zero.xyz/host/x402-gateway.blackwoodstate8.workers.dev/llms.txt)
