How get cached Input tokens? #1050
Replies: 1 comment
|
From the current types/adapters, the field you want is
for await (const chunk of chat({ /* ... */ })) {
if ("finishReason" in chunk) {
const cachedInputTokens = chunk.usage?.promptTokensDetails?.cachedTokens ?? 0
const cacheWriteTokens = chunk.usage?.promptTokensDetails?.cacheWriteTokens ?? 0
}
}For the OpenAI adapters, TanStack AI maps provider values like |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Someone knows how i can get the cached inputs? Into usage of ai i receive the output, the input and total tokens but i not know how much of this tokens are cached
All reactions