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.
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.
Price: 0.004 USDC per call (x402, eip155:8453). Typical response time: 1500 ms (p95).
POST https://x402-gateway.blackwoodstate8.workers.dev/v1/sentiment. A request without payment gets 402 Payment Required with the
PAYMENT-REQUIRED header; any x402 client signs an EIP-3009 authorization and retries with
PAYMENT-SIGNATURE (or X-PAYMENT). Invalid input is answered with 400 and not charged.
curl -i -X POST https://x402-gateway.blackwoodstate8.workers.dev/v1/sentiment -H 'content-type: application/json' -d '{"texts":["The checkout was fast and the support team was great.","The package arrived broken and nobody answered my emails."]}'
| Pay to | 0xd25cA2Ea2a5017b4297157b0635E3FDBB26A326A |
|---|---|
| Asset | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (USDC) |
| Amount | 4000 atomic units (0.004 USDC) |
| Authorization window | 60 s |
Streamable HTTP at https://x402-gateway.blackwoodstate8.workers.dev/mcp, tool blackwood_text_sentiment. Payment goes in
_meta["x402/payment"]; without it the tool returns the payment requirements.
| Field | Type | Meaning |
|---|---|---|
text (optional) | string | One English text to classify, e.g. The checkout was fast (up to 2000 characters) |
texts (optional) | array | Or a batch of up to 20 English texts, e.g. ["Great support", "Broken on arrival"] |
Example:
{
"texts": [
"The checkout was fast and the support team was great.",
"The package arrived broken and nobody answered my emails."
]
}
Real example:
{
"results": [
{
"text": "The checkout was fast and the support team was great.",
"label": "positive",
"score": 0.9999,
"positive": 0.9999,
"negative": 0.0001
},
{
"text": "The package arrived broken and nobody answered my emails.",
"label": "negative",
"score": 0.9998,
"positive": 0.0002,
"negative": 0.9998
}
],
"model": "@cf/huggingface/distilbert-sst-2-int8"
}
{
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"label": {
"type": "string",
"enum": [
"positive",
"negative"
]
},
"score": {
"type": "number"
},
"positive": {
"type": "number"
},
"negative": {
"type": "number"
}
},
"required": [
"text",
"label",
"score",
"positive",
"negative"
],
"additionalProperties": false
}
},
"model": {
"type": "string"
},
"next": {
"type": "object",
"properties": {
"service": {
"type": "string",
"description": "Service id of the suggested next paid call"
},
"tool": {
"type": "string",
"description": "MCP tool name of the same call"
},
"method": {
"type": "string",
"enum": [
"GET",
"POST"
]
},
"url": {
"type": "string",
"description": "Paid route of the next call"
},
"useWhen": {
"type": "string",
"description": "When the next call is the right one"
},
"sample": {
"type": "string",
"description": "Free fixed sample of the whole family"
}
},
"required": [
"service",
"tool",
"method",
"url",
"useWhen",
"sample"
],
"additionalProperties": false,
"description": "Suggested next paid call in the same family (call it in a loop when the task continues)"
}
},
"required": [
"results",
"model"
],
"additionalProperties": false
}Free schema and example: GET https://x402-gateway.blackwoodstate8.workers.dev/v1/sentiment.
OpenAPI 3.1 · llms.txt · All services