@@ -562,6 +562,54 @@ export interface BetaCacheCreation {
562562 ephemeral_5m_input_tokens : number ;
563563}
564564
565+ export interface BetaCacheMissMessagesChanged {
566+ /**
567+ * Approximate number of input tokens that would have been read from cache had the
568+ * prefix matched the previous request.
569+ */
570+ cache_missed_input_tokens : number ;
571+
572+ type : 'messages_changed' ;
573+ }
574+
575+ export interface BetaCacheMissModelChanged {
576+ /**
577+ * Approximate number of input tokens that would have been read from cache had the
578+ * prefix matched the previous request.
579+ */
580+ cache_missed_input_tokens : number ;
581+
582+ type : 'model_changed' ;
583+ }
584+
585+ export interface BetaCacheMissPreviousMessageNotFound {
586+ type : 'previous_message_not_found' ;
587+ }
588+
589+ export interface BetaCacheMissSystemChanged {
590+ /**
591+ * Approximate number of input tokens that would have been read from cache had the
592+ * prefix matched the previous request.
593+ */
594+ cache_missed_input_tokens : number ;
595+
596+ type : 'system_changed' ;
597+ }
598+
599+ export interface BetaCacheMissToolsChanged {
600+ /**
601+ * Approximate number of input tokens that would have been read from cache had the
602+ * prefix matched the previous request.
603+ */
604+ cache_missed_input_tokens : number ;
605+
606+ type : 'tools_changed' ;
607+ }
608+
609+ export interface BetaCacheMissUnavailable {
610+ type : 'unavailable' ;
611+ }
612+
565613export interface BetaCitationCharLocation {
566614 cited_text : string ;
567615
@@ -1330,6 +1378,42 @@ export interface BetaCountTokensContextManagementResponse {
13301378 original_input_tokens : number ;
13311379}
13321380
1381+ /**
1382+ * Response envelope for request-level diagnostics. Present (possibly null)
1383+ * whenever the caller supplied `diagnostics` on the request.
1384+ */
1385+ export interface BetaDiagnostics {
1386+ /**
1387+ * Explains why the prompt cache could not fully reuse the prefix from the request
1388+ * identified by `diagnostics.previous_message_id`. `null` means diagnosis is still
1389+ * pending — the response was serialized before the background comparison
1390+ * completed.
1391+ */
1392+ cache_miss_reason :
1393+ | BetaCacheMissModelChanged
1394+ | BetaCacheMissSystemChanged
1395+ | BetaCacheMissToolsChanged
1396+ | BetaCacheMissMessagesChanged
1397+ | BetaCacheMissPreviousMessageNotFound
1398+ | BetaCacheMissUnavailable
1399+ | null ;
1400+ }
1401+
1402+ /**
1403+ * Request-level diagnostics. Currently carries the previous response id for
1404+ * prompt-cache divergence reporting.
1405+ */
1406+ export interface BetaDiagnosticsParam {
1407+ /**
1408+ * The `id` (`msg_...`) from this client's previous /v1/messages response. The
1409+ * server compares that request's prompt fingerprint against this one and returns
1410+ * `diagnostics.cache_miss_reason` when the prompt-cache prefix could not be
1411+ * reused. Pass `null` on the first turn to opt in without a prior message to
1412+ * compare.
1413+ */
1414+ previous_message_id ?: string | null ;
1415+ }
1416+
13331417/**
13341418 * Tool invocation directly from the model.
13351419 */
@@ -1746,6 +1830,12 @@ export interface BetaMessage {
17461830 */
17471831 context_management : BetaContextManagementResponse | null ;
17481832
1833+ /**
1834+ * Response envelope for request-level diagnostics. Present (possibly null)
1835+ * whenever the caller supplied `diagnostics` on the request.
1836+ */
1837+ diagnostics : BetaDiagnostics | null ;
1838+
17491839 /**
17501840 * The model that will complete your prompt.\n\nSee
17511841 * [models](https://docs.anthropic.com/en/docs/models-overview) for additional
@@ -3947,6 +4037,12 @@ export interface MessageCreateParamsBase {
39474037 */
39484038 context_management ?: BetaContextManagementConfig | null ;
39494039
4040+ /**
4041+ * Body param: Request-level diagnostics. Currently carries the previous response
4042+ * id for prompt-cache divergence reporting.
4043+ */
4044+ diagnostics ?: BetaDiagnosticsParam | null ;
4045+
39504046 /**
39514047 * Body param: Specifies the geographic region for inference processing. If not
39524048 * specified, the workspace's `default_inference_geo` is used.
@@ -4465,6 +4561,12 @@ export declare namespace Messages {
44654561 type BetaBashCodeExecutionToolResultErrorParam as BetaBashCodeExecutionToolResultErrorParam ,
44664562 type BetaCacheControlEphemeral as BetaCacheControlEphemeral ,
44674563 type BetaCacheCreation as BetaCacheCreation ,
4564+ type BetaCacheMissMessagesChanged as BetaCacheMissMessagesChanged ,
4565+ type BetaCacheMissModelChanged as BetaCacheMissModelChanged ,
4566+ type BetaCacheMissPreviousMessageNotFound as BetaCacheMissPreviousMessageNotFound ,
4567+ type BetaCacheMissSystemChanged as BetaCacheMissSystemChanged ,
4568+ type BetaCacheMissToolsChanged as BetaCacheMissToolsChanged ,
4569+ type BetaCacheMissUnavailable as BetaCacheMissUnavailable ,
44684570 type BetaCitationCharLocation as BetaCitationCharLocation ,
44694571 type BetaCitationCharLocationParam as BetaCitationCharLocationParam ,
44704572 type BetaCitationConfig as BetaCitationConfig ,
@@ -4512,6 +4614,8 @@ export declare namespace Messages {
45124614 type BetaContextManagementConfig as BetaContextManagementConfig ,
45134615 type BetaContextManagementResponse as BetaContextManagementResponse ,
45144616 type BetaCountTokensContextManagementResponse as BetaCountTokensContextManagementResponse ,
4617+ type BetaDiagnostics as BetaDiagnostics ,
4618+ type BetaDiagnosticsParam as BetaDiagnosticsParam ,
45154619 type BetaDirectCaller as BetaDirectCaller ,
45164620 type BetaDocumentBlock as BetaDocumentBlock ,
45174621 type BetaEncryptedCodeExecutionResultBlock as BetaEncryptedCodeExecutionResultBlock ,
0 commit comments