- QA bots that provide extensive preset content, such as product documentation assistants.
- Frequent queries against a fixed document collection, such as public disclosure Q&A tools for listed companies.
- Periodic analysis of static codebases or knowledge bases, such as various Copilot Agents.
- Viral AI applications with sudden traffic spikes.
- Agent applications with complex interaction rules.
Context Caching vs. RAG
RAG (Retrieval-Augmented Generation) is widely used in the industry for cost reduction in long-text scenarios. The main differences between Context Caching and RAG are:| Dimension | Context Caching | RAG |
|---|---|---|
| Business cost | Highly dependent on business characteristics; in specific scenarios, cost reduction can reach up to 90% | Independent of business characteristics; any business can reduce costs, but recall accuracy issues may degrade answer quality |
| Development cost | Relatively low; the system handles caching automatically, with no additional integration or tuning needed | Relatively high; requires combining RAG with Embedding and continuous business-specific tuning |
| Extra benefit | Improves response speed in long-text scenarios; average first-token latency can drop to within 5s | Original text length can be extended to very long, more friendly for scenarios requiring millions of words in one go |
Recommendation: If your scenario involves frequent queries against fixed content (e.g., FAQs, document Q&A), prioritize Context Caching. If the content is extremely long and query directions are unfixed, consider a RAG solution.
Automatic Caching Mechanism
Kimi API’s Context Caching uses a fully automatic caching mechanism:- No manual creation required: The system automatically identifies and caches frequently used initial contexts.
- No cache ID references needed: When calling
/v1/chat/completions, simply pass messages in the normal way, and the system will automatically match caches in the background. - No TTL management needed: Cache lifecycle is managed automatically by the system, with no manual intervention required.
Billing
For Context Caching billing and pricing details, see the billing information on the Product Pricing page.Notes and Best Practices
- Cache match conditions: The system automatically optimizes caching for frequently repeated initial contexts. Make sure your knowledge content, system prompts, and tool definitions are relatively stable for better cache hit rates.
-
Combining with multi-turn conversations: When using Context Caching in multi-turn conversations, place fixed large contexts (such as knowledge documents) at the beginning of the
messagesarray (before the system message), then append user questions and model replies. The system will automatically identify and cache these fixed contents. - No extra configuration needed: Context Caching is automatically effective for all requests. You do not need to modify your API calling method or add extra parameters. Just focus on your prompt design and business logic.