Skip to content

Commit 272c40f

Browse files
ci: Version Packages (#677)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent c251038 commit 272c40f

57 files changed

Lines changed: 928 additions & 104 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/kind-donuts-dream.md

Lines changed: 0 additions & 76 deletions
This file was deleted.

packages/ai-anthropic/CHANGELOG.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,75 @@
11
# @tanstack/ai-anthropic
22

3+
## 0.13.0
4+
5+
### Minor Changes
6+
7+
- [#242](https://github.com/TanStack/ai/pull/242) [`c251038`](https://github.com/TanStack/ai/commit/c251038c6d8aa84e498f89e314ce5bb233bc689f) - Enhanced token usage reporting for every provider.
8+
9+
`TokenUsage` is now the single canonical run-usage type. It is defined once in
10+
`@tanstack/ai-event-client` (the dependency-free leaf package) and re-exported by
11+
`@tanstack/ai`, so the two packages can no longer drift. It carries optional
12+
detailed breakdowns alongside the core token counts: `promptTokensDetails` /
13+
`completionTokensDetails` (cached, reasoning, audio, and per-modality tokens),
14+
`durationSeconds` for duration-billed models (e.g. Whisper transcription),
15+
`providerUsageDetails` for provider-specific metrics, and `cost` / `costDetails`
16+
for provider-reported cost — so a single `usage` shape covers counts, detailed
17+
breakdowns, and cost.
18+
19+
`TokenUsage` is generic over its provider details bag —
20+
`TokenUsage<TProviderDetails = ProviderUsageDetails>` — so adapters return a
21+
strongly-typed `providerUsageDetails` (e.g. `TokenUsage<AnthropicProviderUsageDetails>`)
22+
while generic consumers keep the open-record default. The default,
23+
`ProviderUsageDetails` (`Record<string, NonNullable<unknown>>`), is now exported and
24+
uses non-nullish values rather than `unknown` so `TokenUsage` stays assignable across
25+
JSON-serialization boundaries (e.g. TanStack Start server-fn return types). Each
26+
provider's usage
27+
extractor now returns `undefined` (rather than fabricating zeroed totals) when
28+
the provider reports no usage object, so an absent `usage` is distinguishable
29+
from a genuine zero-token run.
30+
31+
`@tanstack/ai` still exports `UsageTotals` as a `@deprecated` alias of
32+
`TokenUsage` for backward compatibility; it will be removed in a future release.
33+
34+
Detailed usage is extracted in one place per SDK surface: OpenAI-compatible
35+
providers (OpenAI, Grok, Groq) share the extractors in `@tanstack/openai-base`,
36+
while Anthropic, Gemini, Ollama, and OpenRouter normalize their own provider
37+
usage. The devtools surface cached and reasoning token badges per iteration.
38+
39+
Usage is now unified across **every modality**, not just text/chat. Image, audio,
40+
and text-to-speech results report the same canonical `TokenUsage` (with
41+
per-modality breakdowns) instead of a minimal `inputTokens`/`outputTokens` shape:
42+
- `ImageGenerationResult.usage`, `AudioGenerationResult.usage`, and the new
43+
`TTSResult.usage` are now typed as `TokenUsage`. **Breaking:** consumers of
44+
these fields should read `promptTokens`/`completionTokens` instead of
45+
`inputTokens`/`outputTokens`. `@tanstack/ai-event-client`'s `ImageUsage` is now
46+
a `@deprecated` alias of `TokenUsage`.
47+
- OpenAI/Grok image generation surface the text-vs-image input token breakdown
48+
(`promptTokensDetails`), Gemini image/audio/TTS now surface their full
49+
`usageMetadata` (previously dropped), and OpenRouter image generation surfaces
50+
the chat usage it already returns.
51+
- Bug fixes: Ollama no longer produces `NaN` totals or discards duration-only
52+
usage; Anthropic defaults missing `output_tokens` and no longer emits empty
53+
`promptTokensDetails`/`providerUsageDetails` objects; OpenAI GPT-4o
54+
transcription reads the real audio/text input token breakdown and never falls
55+
back to duration billing.
56+
57+
Cross-adapter usage parity fixes:
58+
- `PromptTokensDetails`/`CompletionTokensDetails` gain a `documentTokens` field,
59+
and Gemini now surfaces `DOCUMENT` modality token counts (e.g. PDF inputs)
60+
instead of silently dropping them.
61+
- OpenAI-compatible chat (OpenAI/Grok/Groq via `@tanstack/openai-base`) now
62+
surfaces Predicted-Outputs `acceptedPredictionTokens`/`rejectedPredictionTokens`
63+
under `providerUsageDetails`, matching the OpenRouter adapter (rejected
64+
prediction tokens are billed).
65+
- Grok transcription (`/v1/stt`) now reports `durationSeconds`, mirroring the
66+
Whisper-1 path in the OpenAI transcription adapter.
67+
68+
### Patch Changes
69+
70+
- Updated dependencies [[`c251038`](https://github.com/TanStack/ai/commit/c251038c6d8aa84e498f89e314ce5bb233bc689f)]:
71+
- @tanstack/ai@0.25.0
72+
373
## 0.12.0
474

575
### Minor Changes

packages/ai-anthropic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/ai-anthropic",
3-
"version": "0.12.0",
3+
"version": "0.13.0",
44
"description": "Anthropic Claude adapter for TanStack AI chat, tool calling, thinking, and structured outputs.",
55
"author": "",
66
"license": "MIT",

packages/ai-client/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @tanstack/ai-client
22

3+
## 0.15.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`c251038`](https://github.com/TanStack/ai/commit/c251038c6d8aa84e498f89e314ce5bb233bc689f)]:
8+
- @tanstack/ai@0.25.0
9+
- @tanstack/ai-event-client@0.5.0
10+
311
## 0.15.0
412

513
### Minor Changes

packages/ai-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/ai-client",
3-
"version": "0.15.0",
3+
"version": "0.15.1",
44
"description": "Framework-agnostic headless client for TanStack AI chat, realtime sessions, streaming transports, and media generations.",
55
"author": "",
66
"license": "MIT",

packages/ai-code-mode-skills/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @tanstack/ai-code-mode-skills
22

3+
## 0.2.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`c251038`](https://github.com/TanStack/ai/commit/c251038c6d8aa84e498f89e314ce5bb233bc689f)]:
8+
- @tanstack/ai@0.25.0
9+
- @tanstack/ai-code-mode@0.2.1
10+
311
## 0.2.0
412

513
### Minor Changes

packages/ai-code-mode-skills/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/ai-code-mode-skills",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Persistent runtime skill library for TanStack AI Code Mode agents and sandboxed tool orchestration.",
55
"author": "",
66
"license": "MIT",

packages/ai-code-mode/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @tanstack/ai-code-mode
22

3+
## 0.2.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`c251038`](https://github.com/TanStack/ai/commit/c251038c6d8aa84e498f89e314ce5bb233bc689f)]:
8+
- @tanstack/ai@0.25.0
9+
310
## 0.2.0
411

512
### Minor Changes

packages/ai-code-mode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/ai-code-mode",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Secure TypeScript Code Mode for TanStack AI agents to execute sandboxed tool orchestration programs.",
55
"author": "",
66
"license": "MIT",

packages/ai-devtools/CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,74 @@
11
# @tanstack/ai-devtools-core
22

3+
## 0.4.4
4+
5+
### Patch Changes
6+
7+
- [#242](https://github.com/TanStack/ai/pull/242) [`c251038`](https://github.com/TanStack/ai/commit/c251038c6d8aa84e498f89e314ce5bb233bc689f) - Enhanced token usage reporting for every provider.
8+
9+
`TokenUsage` is now the single canonical run-usage type. It is defined once in
10+
`@tanstack/ai-event-client` (the dependency-free leaf package) and re-exported by
11+
`@tanstack/ai`, so the two packages can no longer drift. It carries optional
12+
detailed breakdowns alongside the core token counts: `promptTokensDetails` /
13+
`completionTokensDetails` (cached, reasoning, audio, and per-modality tokens),
14+
`durationSeconds` for duration-billed models (e.g. Whisper transcription),
15+
`providerUsageDetails` for provider-specific metrics, and `cost` / `costDetails`
16+
for provider-reported cost — so a single `usage` shape covers counts, detailed
17+
breakdowns, and cost.
18+
19+
`TokenUsage` is generic over its provider details bag —
20+
`TokenUsage<TProviderDetails = ProviderUsageDetails>` — so adapters return a
21+
strongly-typed `providerUsageDetails` (e.g. `TokenUsage<AnthropicProviderUsageDetails>`)
22+
while generic consumers keep the open-record default. The default,
23+
`ProviderUsageDetails` (`Record<string, NonNullable<unknown>>`), is now exported and
24+
uses non-nullish values rather than `unknown` so `TokenUsage` stays assignable across
25+
JSON-serialization boundaries (e.g. TanStack Start server-fn return types). Each
26+
provider's usage
27+
extractor now returns `undefined` (rather than fabricating zeroed totals) when
28+
the provider reports no usage object, so an absent `usage` is distinguishable
29+
from a genuine zero-token run.
30+
31+
`@tanstack/ai` still exports `UsageTotals` as a `@deprecated` alias of
32+
`TokenUsage` for backward compatibility; it will be removed in a future release.
33+
34+
Detailed usage is extracted in one place per SDK surface: OpenAI-compatible
35+
providers (OpenAI, Grok, Groq) share the extractors in `@tanstack/openai-base`,
36+
while Anthropic, Gemini, Ollama, and OpenRouter normalize their own provider
37+
usage. The devtools surface cached and reasoning token badges per iteration.
38+
39+
Usage is now unified across **every modality**, not just text/chat. Image, audio,
40+
and text-to-speech results report the same canonical `TokenUsage` (with
41+
per-modality breakdowns) instead of a minimal `inputTokens`/`outputTokens` shape:
42+
- `ImageGenerationResult.usage`, `AudioGenerationResult.usage`, and the new
43+
`TTSResult.usage` are now typed as `TokenUsage`. **Breaking:** consumers of
44+
these fields should read `promptTokens`/`completionTokens` instead of
45+
`inputTokens`/`outputTokens`. `@tanstack/ai-event-client`'s `ImageUsage` is now
46+
a `@deprecated` alias of `TokenUsage`.
47+
- OpenAI/Grok image generation surface the text-vs-image input token breakdown
48+
(`promptTokensDetails`), Gemini image/audio/TTS now surface their full
49+
`usageMetadata` (previously dropped), and OpenRouter image generation surfaces
50+
the chat usage it already returns.
51+
- Bug fixes: Ollama no longer produces `NaN` totals or discards duration-only
52+
usage; Anthropic defaults missing `output_tokens` and no longer emits empty
53+
`promptTokensDetails`/`providerUsageDetails` objects; OpenAI GPT-4o
54+
transcription reads the real audio/text input token breakdown and never falls
55+
back to duration billing.
56+
57+
Cross-adapter usage parity fixes:
58+
- `PromptTokensDetails`/`CompletionTokensDetails` gain a `documentTokens` field,
59+
and Gemini now surfaces `DOCUMENT` modality token counts (e.g. PDF inputs)
60+
instead of silently dropping them.
61+
- OpenAI-compatible chat (OpenAI/Grok/Groq via `@tanstack/openai-base`) now
62+
surfaces Predicted-Outputs `acceptedPredictionTokens`/`rejectedPredictionTokens`
63+
under `providerUsageDetails`, matching the OpenRouter adapter (rejected
64+
prediction tokens are billed).
65+
- Grok transcription (`/v1/stt`) now reports `durationSeconds`, mirroring the
66+
Whisper-1 path in the OpenAI transcription adapter.
67+
68+
- Updated dependencies [[`c251038`](https://github.com/TanStack/ai/commit/c251038c6d8aa84e498f89e314ce5bb233bc689f)]:
69+
- @tanstack/ai@0.25.0
70+
- @tanstack/ai-event-client@0.5.0
71+
372
## 0.4.3
473

574
### Patch Changes

0 commit comments

Comments
 (0)