docs: document Anthropic cache TTL count details (#31708)

This commit is contained in:
ccurme
2025-06-23 16:16:42 -04:00
committed by GitHub
parent e6191d58e7
commit ee83993b91
6 changed files with 68 additions and 0 deletions

View File

@@ -568,6 +568,26 @@
" ```\n",
" and specifying `\"cache_control\": {\"type\": \"ephemeral\", \"ttl\": \"1h\"}`.\n",
"\n",
" Details of cached token counts will be included on the `InputTokenDetails` of response's `usage_metadata`:\n",
"\n",
" ```python\n",
" response = llm.invoke(messages)\n",
" response.usage_metadata\n",
" ```\n",
" ```\n",
" {\n",
" \"input_tokens\": 1500,\n",
" \"output_tokens\": 200,\n",
" \"total_tokens\": 1700,\n",
" \"input_token_details\": {\n",
" \"cache_read\": 0,\n",
" \"cache_creation\": 1000,\n",
" \"ephemeral_1h_input_tokens\": 750,\n",
" \"ephemeral_5m_input_tokens\": 250,\n",
" }\n",
" }\n",
" ```\n",
"\n",
":::"
]
},