Repository navigation
@tanstack/ai-bedrock@0.5.0
Minor Changes
-
#1677
f562eac-usage.promptTokensis now the total input on the Anthropic, Bedrock Converse, and Claude Code adapters. It is the uncached tokens plus the cache reads plus the cache writes. Before, it was the uncached tokens only.totalTokensnow uses the newpromptTokens. The cache parts stay inpromptTokensDetails.cachedTokensandpromptTokensDetails.cacheWriteTokens. Other adapters already reportpromptTokensthis way.Breaking: if your code adds
cachedTokensorcacheWriteTokenstopromptTokensto get the total input, it now counts the cache two times. UsepromptTokensas the total. To get the uncached tokens, subtractcachedTokensandcacheWriteTokensfrompromptTokens.
Patch Changes
-
#1680
377262c- AddwrapFetchtochat(), to the middlewareonConfigconfig, and toTextOptions. A wrapper gets the next fetch and gives back a new fetch. Use it to change the URL, the headers, the request, or the response of a model call. The newFetchWrappertype names the wrapper.The engine chains the
chat()wrapper and the middleware wrappers into one function. A middleware wrapper runs inside thechat()wrapper and applies to one model call only.These text adapters send their requests through the wrapper: every adapter on
@tanstack/openai-base(OpenAI, the OpenAI-compatible adapters, Grok, Groq, BytePlus, LLM Gateway, Lovable, Vercel AI Gateway, Cloudflare, and the Bedrock Chat Completions and Responses APIs), Anthropic, Mistral, Ollama, and OpenRouter. The wrapper wraps the fetch of the adapter config, not the global fetch. An Anthropic or Ollama adapter with an injected client ignoreswrapFetch. In Cloudflare binding mode, the wrapper runs, but the binding does not send the URL or the headers. WithoutwrapFetch, the requests do not change. -
Updated dependencies [
7dbfaf6,88fd67c,3aa2e3d,c5ae415,13ba1b0,377262c]:- @tanstack/ai@0.67.0
- @tanstack/openai-base@0.13.0