본문으로 건너뛰기
Skillpedia
프롬프트 및 LLM280k · #386

prompt-caching-strategy

하는 일

이 도구는 AI에 보내는 지시를 더 잘 정리해서 비용을 줄이고 AI 응답을 빠르게 하도록 돕습니다. 지시에서 반복되는 부분이 항상 같도록 보장해, AI가 이전 답변을 재사용할 수 있게 합니다.

사용하는 경우

  • ✓매우 비슷한 요청을 AI에 반복해서 보낼 때.
  • ✓AI가 더 빠르게 응답하기를 원할 때.
  • ✓AI 서비스 사용 비용을 낮추고 싶을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/affaan-m/ECC/blob/main/skills/prompt-caching-strategy/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“AI가 캐시를 사용해서 제가 돈을 덜 내도록 프롬프트를 어떻게 정리할 수 있나요?”

매주 새 스킬 5개. 읽는 데 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'란 무엇인가요?

AI가 이미 받은 질문에 대한 답을 저장해 두는 임시 메모리와 같습니다. 같은 질문이 오면 모든 것을 다시 계산하는 대신 저장된 답을 사용합니다.

모든 AI에 작동하나요?

일부 특정 AI, 예를 들어 OpenAI와 Claude에서 작동합니다. 각각 설정 방법은 문서를 확인해야 합니다.

캐싱이 컨텍스트 창의 크기를 줄이나요?

아니요. 캐싱은 AI의 컨텍스트 창 사용량을 줄이지 않습니다. 정보를 재사용해 과정을 더 빠르고 저렴하게 만드는 데 도움을 줄 뿐입니다.

상세 정보

작성자의 원본 설명

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
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬