Lean into provider-native caching (explicit Gemini context caching, docs, visibility)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- python
- Domain
- ai, documentation
Research direction
Start with _provider_google.py and the new Chat.files accessor, then compare cache handling in _provider_anthropic.py and _provider_openai.py. Clarify the API design for explicit Gemini context caching, the caching guide, and any small parameter exposure. Done means the agreed provider-native caching behavior and documentation cover cached_input, provider defaults, TTL tradeoffs, and cache-friendly prompts.
Written by the indexing model from the issue text.
Description
Motivation
Client-side response caches (LangChain's set_llm_cache, LiteLLM's caching layer) date from early 2023, before Anthropic prompt caching (Aug 2024), OpenAI automatic prompt caching (Oct 2024), or Gemini context caching existed. The providers now solve the underlying cost/latency problem better, and chatlas already leans into that harder than most frameworks:
- Anthropic/Bedrock:
cache="5m"on by default, withcache_controlinjection and cache-write cost multipliers (1.25×/2×) reflected inget_cost()(_provider_anthropic.py). - OpenAI: automatic server-side caching;
cached_tokensextracted and priced (_provider_openai.py). - Google: implicit-cache token counts tracked (
_provider_google.py). get_tokens()/get_cost()exposecached_inputas a first-class field; prior art in #103, #133, #158, #243 (all closed).
What remains is closing the gaps, not adding a new cache layer.
Proposed work
- Explicit Gemini context caching — the one concrete API gap. Support Google's explicit caching (
client.caches.create(...)with a TTL, then reference the cached content across calls). This dovetails with the newChat.filesaccessor: same "register once, reference cheaply across turns" model. Whether it surfaces as achat.files-like accessor, a content type (cf. #136content_ephemeral()), or aChatGoogle()parameter is the main design question. - A caching guide in the docs — the current defaults are good but invisible. Cover: what each provider does automatically, how to read
cached_inputfromget_tokens()to check your hit rate, Anthropic TTL tradeoffs ("5m"vs"1h"write multipliers), and how to keep prompts cache-friendly (stable prefix; don't churn the system prompt or tool set mid-conversation). - Small parameter exposure — e.g. OpenAI's
prompt_cache_keyrouting hint for improving hit rates. Low priority for chatlas's typical single-process user, but cheap. - Cross-issue design note — prefix caches reward immutable history, so history compaction (#356) and mutable system prompts are cache-busting operations. The #356 design should account for the one-time cost cliff after a compaction.
Non-goal: client-side response cache
A LangChain-style client-side response cache is out of scope. Its one honest use case — replaying an identical request without paying again (prompt caching discounts input tokens but never eliminates the call or the output tokens) — is better served elsewhere:
- Notebook/script re-runs: that's a persistence problem — reload the earlier conversation (#352
chat.save()/Chat.load()) instead of re-asking the model. - Tests/CI: VCR-style request recording (what chatlas's own test suite uses via
pytest-recording) is purpose-built for this. - Treating nondeterministic calls as cacheable pure functions also has real surprise potential (a cache silently freezes responses that users expect to vary).
Part of the July 2026 competitive-review workstreams (#360).
- Dominant language
- Python
- Stars
- 179
- Forks
- 32
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 10
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from posit-dev/chatlas
-
A streaming text delta that repeats everything streamed so far is missing from the recorded turnPossibly taken @cpsievert claimed this 81 days ago. Openai-triage:done Priority: Medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
ai-triage:needs-review documentation
Difficulty 2/5 1-2 days Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
ai-triage:done Priority: Low
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
All issues in posit-dev/chatlas
Similar issues
-
jira: an unquoted JQL number of more than 4300 digits is a plain-text 500, where real answers 200Openfidelity
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
A JSON chat answer blocks the backend event loop for the whole RAG runPossibly taken @NopeCharon claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
The-OpenROAD-Project/ORAssistant#656 ·
Maintainers usually reply within 1 day
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorPossibly taken @jejjohnson claimed this today. Opentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jejjohnson/integrix#144 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
finos/ai-governance-framework#459 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainers usually reply within 1 day