exa-cost-tuning
Installation
SKILL.md
Exa Cost Tuning
Overview
Reduce Exa AI search API costs by implementing caching, choosing the right search type, and limiting result count per query. Exa charges per search with costs varying by plan tier.
Prerequisites
- Exa API account with usage dashboard access
- Understanding of search patterns in your application
- Cache infrastructure (Redis or in-memory)
Instructions
Step 1: Implement Query-Level Caching
import { LRUCache } from 'lru-cache';
const searchCache = new LRUCache<string, any>({ max: 5000, ttl: 3600_000 }); // 1hr TTL # 5000: 5 seconds in ms
async function cachedSearch(query: string, options: any) {
const cacheKey = `${query}:${options.type}:${options.numResults}`;
Related skills