feat: expose prompt caching env var settings #273

Open
opened 2026-05-06 12:24:56 -07:00 by hikari · 0 comments
Owner

Overview

CLI v2.1.108 added two env vars for configuring prompt cache TTL: ENABLE_PROMPT_CACHING_1H (opt into 1-hour cache TTL) and FORCE_PROMPT_CACHING_5M (force 5-minute TTL). These should be exposable via the app's settings UI for power users.

Changes Required

  • Add a prompt caching setting section to src/lib/components/ConfigSidebar.svelte (or the relevant settings area)
  • Options:
    • Default (no override)
    • 1-hour TTL (ENABLE_PROMPT_CACHING_1H=1)
    • Force 5-minute TTL (FORCE_PROMPT_CACHING_5M=1)
  • When selected, inject the appropriate env var when starting Claude Code

Context

From the v2.1.108 changelog:

Added ENABLE_PROMPT_CACHING_1H env var to opt into 1-hour prompt cache TTL on API key, Bedrock, Vertex, and Foundry (ENABLE_PROMPT_CACHING_1H_BEDROCK is deprecated but still honored), and FORCE_PROMPT_CACHING_5M to force 5-minute TTL

Also from the v2.1.108 changelog:

Added a warning at startup when prompt caching is disabled via DISABLE_PROMPT_CACHING* environment variables

The 1-hour TTL is especially useful for long-running sessions, as it significantly reduces token costs for repeated context. This is a setting that power users actively benefit from.

References

  • Claude Code CLI v2.1.108 changelog

This issue was created with help from Hikari~ 🌸

## Overview CLI v2.1.108 added two env vars for configuring prompt cache TTL: `ENABLE_PROMPT_CACHING_1H` (opt into 1-hour cache TTL) and `FORCE_PROMPT_CACHING_5M` (force 5-minute TTL). These should be exposable via the app's settings UI for power users. ## Changes Required - Add a prompt caching setting section to `src/lib/components/ConfigSidebar.svelte` (or the relevant settings area) - Options: - Default (no override) - 1-hour TTL (`ENABLE_PROMPT_CACHING_1H=1`) - Force 5-minute TTL (`FORCE_PROMPT_CACHING_5M=1`) - When selected, inject the appropriate env var when starting Claude Code ## Context From the v2.1.108 changelog: > Added `ENABLE_PROMPT_CACHING_1H` env var to opt into 1-hour prompt cache TTL on API key, Bedrock, Vertex, and Foundry (`ENABLE_PROMPT_CACHING_1H_BEDROCK` is deprecated but still honored), and `FORCE_PROMPT_CACHING_5M` to force 5-minute TTL Also from the v2.1.108 changelog: > Added a warning at startup when prompt caching is disabled via `DISABLE_PROMPT_CACHING*` environment variables The 1-hour TTL is especially useful for long-running sessions, as it significantly reduces token costs for repeated context. This is a setting that power users actively benefit from. ## References - Claude Code CLI v2.1.108 changelog ✨ This issue was created with help from Hikari~ 🌸
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/hikari-desktop#273