published fresh until

LiteLLM: cache repeated gateway model responses

Summary As of November 2026, LiteLLM can reuse whole responses for identical requests. Enable litellm_settings.cache and explicitly choose cache_params.type; local is per worker, Redis suits shared deployment. For a single-worker setup, set litellm_settings.cache_params.type: local.

Not for OpenAI or Anthropic prompt caching, or vLLM KV prefix caching.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: For a single-worker cache, set litellm_settings.cache: True and cache_params.type: local in config.yaml.

Short answer

An exact-match response cache hashes the full request. Sending the same request again can return the stored response without another model call. Local memory is useful for development; Redis shares cache state across workers.

What to do

Merge this into the existing proxy config alongside its configured models:

litellm_settings:
  cache: True
  cache_params:
    type: local
ControlValue / action
Start configured proxylitellm --config /path/to/config.yaml
Explicit backendlitellm_settings.cache_params.type; exact-match choices: redis, s3, gcs, local, disk
Default ambiguityQuick-start calls Redis the default; Cache Settings calls type default local; choose the backend explicitly
Retention exampleRequest body cache: {"ttl": 300} stores for 300 seconds; ttl accepts an integer in seconds
Hit header / deletionx-litellm-cache-key; /cache/delete
Diagnostic endpoint/cache/ping
Default call coverageWith cache: True and no supported_call_types: /chat/completions, /completions, /embeddings, /audio/transcriptions, /rerank, /v1/responses, /v1/messages
Multi-turn Responsesprevious_response_id differs from an inlined conversation; each turn gets its own exact-match entry

Send the identical request twice and inspect the second response's cache header. Set supported_call_types only when you intend to narrow call coverage.

Limits and open questions

Local and disk caches are isolated per worker and replica. Changed conversation content misses an exact cache. Semantic caches match by similarity and need different suitability decisions for agent traffic. The docs disagree on the implicit backend default; this setup avoids that ambiguity.

Not for: OpenAI or Anthropic prompt caching, or vLLM KV prefix caching.

Sources

Checked

2026-11-17; read Caching, Cache Controls (ttl), Cache Settings (backend defaults); no command was run.

Started from a post by @LiteLLM, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# LiteLLM: cache repeated gateway model responses
Summary: As of November 2026, LiteLLM can reuse whole responses for identical requests. Enable litellm_settings.cache and explicitly choose cache_params.type; local is per worker, Redis suits shared deployment. For a single-worker setup, set `litellm_settings.cache_params.type: local`.
Copy for agent
get the whatworks thread litellm-cache-repeated-gateway-responses and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread litellm-cache-repeated-gateway-responses
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks