मुख्य सामग्री पर जाएँ
Skillpedia
प्रॉम्प्ट और LLM280k · #386

prompt-caching-strategy

यह क्या करती है

यह टूल AI को भेजे जाने वाले निर्देशों को बेहतर तरीके से व्यवस्थित करके लागत कम करने और AI के जवाब तेज़ करने में मदद करता है। यह ध्यान रखता है कि निर्देशों के दोहराए जाने वाले हिस्से हमेशा एक जैसे रहें, ताकि AI पिछले जवाबों को दोबारा इस्तेमाल कर सके।

कब इस्तेमाल करें

  • ✓जब आप AI को बार-बार बहुत मिलते-जुलते अनुरोध भेजते हों।
  • ✓जब आप चाहते हों कि AI तेज़ जवाब दे।
  • ✓AI सेवाओं का खर्च कम करने के लिए।

Skill का लिंक

https://github.com/affaan-m/ECC/blob/main/skills/prompt-caching-strategy/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/affaan-m/ECC/blob/main/skills/prompt-caching-strategy/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मैं अपने prompts को कैसे व्यवस्थित करूँ ताकि AI cache का इस्तेमाल करे और मेरा खर्च कम हो?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

टूल सुझाव देता है कि निर्देशों के स्थिर हिस्से (जैसे नियम या उदाहरण) को उस हिस्से से अलग रखें जो हर बार बदलता है (जैसे मौजूदा सवाल)। इससे AI स्थिर हिस्सों को आसानी से पहचानकर दोबारा इस्तेमाल कर सकता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Prompt Caching Strategy

Arrange reusable prompt content to improve cache reuse, then measure input cost and latency. Savings depend on model, platform, cache eligibility, writes, retention, reuse and output volume. Runtime cache hits and savings for this skill are unmeasured; the examples below validate arithmetic without provider calls.

When to Activate

Use for repeated API requests that share authorized instructions, tools or reference material. First identify the exact provider endpoint, model, service tier and caching mode. Consult its current documentation before selecting rates, minimum prefix length or retention. Caching does not reduce context-window use.

How It Works

Preserve a stable prefix

Keep reusable instructions, tool schemas and examples stable; place changing questions, timestamps and retrieved results after that content where the API allows. Respect the provider's serialization order: Claude uses tools, system, then messages. Matching prefixes need identical content, including tool schemas and relevant request settings. A changed prefix can prevent reuse from that point. A dynamic suffix may itself be cached later if reused unchanged.

Reusable prefix: approved tools, instructions, stable examples/reference
Changing suffix: current question, fresh retrieval results, request metadata

Choose only relevant context. Padding prompts or broadening access just to meet an eligibility threshold needs its own cost and quality justification.

Preserve user and workspace boundaries

Authorize content access before cache lookup or reuse. Scope application-managed cache handles and accounting keys to the approved user, workspace, provider account, model and content revision. Share only material explicitly approved for that scope. A cache key is a routing/accounting hint, not an authorization gate or a sandbox. Provider cache isolation does not replace application access checks. Invalidate application references when permissions or content change; follow provider retention/deletion controls. Avoid logging private prompt contents. Context selection, capabilities, sandbox enforcement and evidence remain independent of cache optimization.

Provider Requirements and Usage Evidence

The linked documentation is authoritative; endpoint and SDK versions can expose different usage field names. Record that version alongside counters.

Provider Requirements to verify Counters to record
OpenAI Model-specific automatic/explicit modes, minimum length, retention and write/read prices; earlier and newer models differ Responses usage.input_tokens_details.cached_tokens and, when present, cache_write_tokens; input and output totals. Chat Completions uses prompt_tokens_details.cached_tokens
Claude Supported platform, model minimum, cache_control support and TTL; cache writes may cost more than ordinary input input_tokens, cache_creation_input_tokens, cache_read_input_tokens, output_tokens; split writes by TTL when rates differ
Gemini Model minimum and API: Interactions supports implicit caching; explicit cache objects require GenerateContent Interactions usage.total_cached_tokens; GenerateContent usage_metadata cache/input/output counters plus explicit-cache token count and retained duration

Use OpenAI's prompt caching guide and pricing for the selected model. For Chat Completions, check the usage schema. Derive ordinary input from the total minus cached reads and any separately reported writes; do not count the same tokens twice.

Use Claude's prompt caching guide for current model/platform limits and TTL rates. Its input_tokens counts ordinary input separately from cache reads and writes. A short prefix can produce zero cache counters even when marked for caching. Do not assume every Claude model or hosted platform uses the same minimum or read price.

Use Gemini's caching guide, GenerateContent caching guide and pricing. Explicit-cache

…

अक्सर पूछे जाने वाले सवाल

'cache' क्या है?

Cache एक अस्थायी मेमोरी की तरह है जहाँ AI उन सवालों के जवाब स्टोर करता है जो पहले पूछे जा चुके हैं। अगर सवाल वही हो, तो वह सब कुछ दोबारा गणना करने के बजाय स्टोर किया हुआ जवाब इस्तेमाल करता है।

क्या यह हर AI के लिए काम करता है?

यह कुछ खास AI के लिए काम करता है, जैसे OpenAI और Claude। हर एक को सेट करने का तरीका जानने के लिए आपको उसका documentation देखना होगा।

क्या caching से context window का आकार घटता है?

नहीं, caching AI की context window का इस्तेमाल कम नहीं करता। यह बस जानकारी को दोबारा इस्तेमाल करने में मदद करता है, ताकि प्रक्रिया तेज़ और सस्ती हो।

जानकारी

लेखक का मूल विवरण

Optimize LLM prompt caching hit rate to reduce API costs and improve latency. Analyzes prompt structure, identifies cacheable vs non-cacheable content, and recommends restructuring to maximize cache reuse. TRIGGER when: user says "prompt cache", "cache hit rate", "reduce LLM cost", "optimize token usage", "cheaper LLM calls", or asks about prompt caching strategies for OpenAI/Anthropic/other provi

repo: affaan-m/ECC

लोकप्रियता

GitHub स्टार
280k
रैंकिंग में स्थान
#386
लाइसेंस
MIT
अपडेट की गई
15/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

accessibility

280k

यह आपके एजेंट को ऐसे इंटरफ़ेस बनाने में मदद करता है जिन्हें हर कोई इस्तेमाल कर सके। यह पक्का करता है कि वेबसाइट और ऐप दिव्यांग लोगों के लिए भी अच्छे से काम करें, जैसे नेत्रहीन या जिन्हें चलने-फिरने में दिक्कत होती है।

डिज़ाइनइंटरफ़ेस (UI/UX)

agent-architecture-audit

280k

यह आपके एजेंट को जाँचने देता है कि सब कुछ सही से चल रहा है। यह AI सिस्टम में समस्याएँ ढूँढकर ठीक करता है, ताकि वे उम्मीद के मुताबिक काम करें।

AI और एजेंटएजेंट

agent-eval

280k

यह आपके एजेंट को अलग-अलग AI coding tools की तुलना करने में मदद करता है। यह मापता है कि किसी खास काम के लिए कौन सा टूल ज़्यादा तेज़, सस्ता और भरोसेमंद है।

AI और एजेंटएजेंट

agent-harness-construction

280k

यह आपके एजेंट को काम कैसे करना है, यह बेहतर समझने में मदद करता है। यह उन tools और instructions को बेहतर बनाता है जिनका एजेंट इस्तेमाल करता है, ताकि उसकी सफलता की संभावना बढ़े।

AI और एजेंटएजेंट

मिलती-जुलती skills