Cost Control 

  • Caching: Set Caching (e.g. aiCacheLifetime = 2592000 = 30 days) to avoid repeated API calls for the same search term.
  • Retrieval: aiTopK and aiMaxCharsPerChunk limit the context size and thus input tokens. aiMaxTokensResponse limits the answer length.
  • Embeddings: One embedding call per search; at index time, one call per index entry. Use affordable embedding models (e.g. Mistral mistral-embed).