Tracking token usage in Foundation Models
Guide to measuring token usage with Apple’s Foundation Models in iOS 26.4: get SystemLanguageModel.contextSize; use model.tokenUsage(for:) for instructions, prompts, tools (schema overhead), and transcripts; compute context %. Caveats: throws if AI disabled; Xcode 26.4 beta SensitiveContentAnalysisML error.