PromptTokensDetails - Python SDK

PromptTokensDetails method reference

The Python SDK and docs are currently in beta. Report issues on GitHub.

Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.

Fields

FieldTypeRequiredDescriptionExample
audio_tokensOptional[int]Number of audio tokens in the input
file_tokensOptional[int]Number of file/document tokens in the input
image_tokensOptional[int]Number of image tokens in the input258
text_tokensOptional[int]Number of text tokens in the input8
video_tokensOptional[int]Number of video tokens in the input