{"uid":"cap_rBtTKluEn1akpZKdUJL6y","slug":"delx-count-substr-69130d1d","name":"Delx Count Substr","description":"Count non-overlapping substring occurrences. Call when you preflight how often a token appears in agent-held text. Returns integer count and needle for $0.001 USDC via x402 on Base. No network, no keys, no retention; first-party local JSON only. Results are advisory; the caller owns budgets, auth, and production controls.","url":"https://api.delx.ai/api/v1/x402/count-substr","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string","description":"Input field: text."},"needle":{"type":"string","description":"Input field: needle."}}},"responseSchema":{"type":"json","example":{"count":2,"needle":"delx","schema":"delx/util-count-substr/v1"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_QBh2vVG1AkcVlaU8r3-GQ","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Counts the number of non-overlapping occurrences of a substring (needle) within a given text string","exampleAgentPrompt":"How many times does the word 'error' appear in this log text: 'error: timeout occurred, error: connection refused, warning: retry limit reached, error: unknown host'?","exampleUseCases":[{"title":"Token frequency check before LLM prompt","prompt":"Before I send this draft to the model, count how many times the word 'please' appears in it — I want to make sure it's not overly repetitive."},{"title":"Keyword audit in scraped content","prompt":"Scan this article text and tell me how many times the substring 'climate change' shows up — I need the count to decide if it's worth including in our topic index."},{"title":"Spam pattern detection in user message","prompt":"Check how many times the phrase 'click here' appears in this email body — if it's more than twice I want to flag it as suspicious."}],"resultDescription":"Returns a JSON object containing an integer count of non-overlapping occurrences of the needle within the text, along with the needle string itself. No data is retained server-side.","failureModes":["Missing 'text' or 'needle' field returns a 400-level error","Empty needle string may cause undefined behavior or error","Payment not fulfilled via x402 results in 402 Payment Required response","Very large text payloads may exceed request size limits"],"whenToPreferThis":"Use this endpoint when an AI agent needs a fast, cheap, local computation to count how many times a specific token or substring appears in text it already holds — no network calls, no external storage, no API keys required beyond x402 payment. Ideal for lightweight preflight checks on token frequency, keyword density, or repeated pattern detection within agent-held strings. At $0.001 USDC per call it is cost-effective for high-frequency agent loops.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:57:11.003Z","isFirstParty":false}