Skip to main content
Process large volumes of Arabic comments efficiently while respecting rate limits and minimizing costs.

Strategy overview

TypeScript batch processing

Python batch processing

Cost optimization

Semantic caching

NAWA automatically caches classification results. When the same or semantically similar text is classified again, the response is served from cache at $0 cost. Check the X-NAWA-Cache response header:
  • HIT - served from cache (free)
  • MISS - new classification (billed)
The cached field in the response body also indicates cache status.

Deduplication

Before sending a batch, deduplicate texts to avoid paying for identical comments:

Cost estimation

Estimate batch cost before processing:
With typical cache hit rates of 20–30%, actual costs are 20–30% lower than the estimates above.

Rate limit guidelines

Always respect the X-RateLimit-Remaining header. If it reaches 0, wait until X-RateLimit-Reset before sending more requests.