{"uid":"cap_0tF2AXFQCw7YSE4pOHPjx","slug":"x402-gateway-sentiment-analysis-distilbert-sst-2-7f3aa8f5","name":"x402-gateway Sentiment Analysis (DistilBERT SST-2)","description":"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.","url":"https://x402-gateway.blackwoodstate8.workers.dev/v1/sentiment?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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},"model":{"type":"string"},"results":{"type":"array","items":{"type":"object","required":["text","label","score","positive","negative"],"properties":{"text":{"type":"string"},"label":{"enum":["positive","negative"],"type":"string"},"score":{"type":"number"},"negative":{"type":"number"},"positive":{"type":"number"}},"additionalProperties":false}}},"additionalProperties":false}}}}},"responseSchema":{"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}]}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_So_HE8qLM98CrxX4vwhjt","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Classifies English text as positive or negative with a confidence score using DistilBERT SST-2, supporting single texts or batches of up to 20.","exampleAgentPrompt":"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'?","exampleUseCases":[{"title":"Product review sentiment scoring","prompt":"I have these three customer reviews — can you classify each one as positive or negative with a confidence score? '1. Amazing quality, worth every penny. 2. Fell apart after two days, very disappointed. 3. Shipping was quick but the item looks cheap.'"},{"title":"News headline tone monitoring","prompt":"Can you analyze the sentiment of these headlines for me and tell me which are positive and which are negative with confidence scores? 'Markets rally to record highs', 'Supply chain crisis deepens', 'New vaccine shows promising results'."},{"title":"Support ticket triage by sentiment","prompt":"Before I escalate these support tickets, can you check which ones have negative sentiment so I can prioritize them? Here are the messages: 'I love the new dashboard update!', 'This is completely broken and I've lost all my data.', 'Works fine for me, thanks!'"}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T01:12:41.764Z","isFirstParty":false,"canonicalSlug":"x402-gateway-sentiment-analysis-distilbert-sst-2-7f3aa8f5"}