Repository navigation
Releases: TanStack/ai
Release list
@tanstack/solid-ai-devtools@1.0.2
@tanstack/openai-base@1.0.1
Patch Changes
-
#1966
e17cae7- Stop the OpenAI Responses adapters from aborting a finished request. Afterresponse.completedthe adapters stopped reading at once, so the OpenAI SDK aborted the request and a gateway such as Cloudflare AI Gateway logged a billed, complete call as a client cancel (499). The adapters now let the body end by itself for up to 250 ms and abort it only after that. -
#1948
940c402- Pass the full diff of a streamedapply_patchcall to the app. The Responses API adds anapply_patch_callwithstatus: "in_progress"and an emptydiff, and streams the diff in before the item is done. The adapter ended the call when the item was added, soexecutealways gotdiff: "", and an agent loop sent empty patches until it hit its iteration limit. A user-run call (apply_patch,local_shell,shell,computer) now starts when its item is added and ends, with its input, once the item is no longer in progress, as function calls already do.If the response completes while a user-run call is still in progress, the run now ends with a
RUN_ERROR(codeincomplete-tool-call) instead of running the tool with incomplete input. -
#1974
09dde65- Report token usage for every call that the provider billed, also when the call fails.- Adapters put the usage that they received on
RUN_ERROR: a cut-off response, a refusal, a parse failure, an empty response, or a stream that fails after usage arrived. Before, many of these paths dropped it. - A non-streaming
structuredOutput(), image, or speech call that fails after the response throws an error with ausagefield.chat(),generateImage(),generateSpeech(), andsummarize()report it. - The
onUsagemiddleware hook now also runs for aRUN_ERRORwith usage. A structured output value that fails the schema check still reports the usage of its call. - Media streams carry
usageonRUN_FINISHEDandRUN_ERROR. Devtools now gets thesummarize:usageandtranscription:usageevents, andtext:usagefor a chatRUN_ERRORwith usage. A call thatonModelErroror a rate-limit retry drops still reports its usage. - Provider fields that were dropped are mapped: Anthropic thinking tokens, Claude Code
total_cost_usdasusage.cost, OpenRouter Responses reasoning tokens, opencode cost and cache writes, ACP and Bedrock cache writes, OpenAI evaluate token details, Gemini Vertex embedding tokens, and audio duration as billed seconds for Whisper, Groq, Cloudflare, and Lovable transcription. - opencode adds up the usage of every agent step in a turn. Before, it counted only the last step.
- Gemini Interactions usage (text, agentic video, and images) counts thought tokens in
completionTokens, the same asgenerateContent.
- Adapters put the usage that they received on
-
Updated dependencies [
9ac67f3,9ac67f3,e17cae7,d6ead13,450950d,07d2e42,13b1ca9,09dde65]:- @tanstack/ai@1.1.0
- @tanstack/ai-utils@1.0.1
@tanstack/ai@1.1.0
Minor Changes
-
#1977
9ac67f3- New optional cancel options. Old calls work the same.embed()takesabortSignalandtimeout. The effective signal reaches the adapter asEmbeddingOptions.abortSignal.getVideoJobStatus()takesabortSignalandtimeout. The video adapter contract adds an optional{ abortSignal }togetVideoStatus(jobId, options?)andgetVideo(jobId, options?). The streaminggenerateVideo()poll passes its signal to both.uploadFile(),getFile(), anddeleteFile()takeabortSignal.FilesAdapter.upload/get/deletetake an optional{ abortSignal }.realtimeToken()takesabortSignal.RealtimeTokenAdapter.generateToken(options?)andRealtimeAdapter.connect(token, clientTools?, options?)take an optional{ abortSignal }.decide()andrerank()taketimeout, and race the adapter call against the signal like the other activities.GenerationMiddlewareContexthas an optionalsignal: the effective activity signal.
-
#1977
9ac67f3- New optional cancel hooks. Old code works the same.MCPToolSource.tools()takes an optionalsignal.chat()passes the signal of itsabortControllerto each MCP source during tool discovery.VideoAdapterhas an optionalcancelVideoJob(jobId, options?)method. A streaminggenerateVideo()calls it (best effort) when itsabortSignalortimeoutaborts after the provider accepted the job. A failed cancel is logged and does not change the abort result.
Patch Changes
-
#1962
d6ead13- Stopchat()from copying the whole assistant answer on every text chunk. A long reply streamed as small deltas no longer blocks the server for seconds. -
#1968
450950d- Run client tools when a custom AG-UI server ends a run withfinishReason: 'tool_calls'and closes the stream. Before, the client waited for a next run that never came, so the tool did not run and the agent loop stopped. The client now runs the unanswered calls when the stream ends. A tool that needs approval asks the user first, the same as for a success outcome. -
#1979
07d2e42- A cancel now stops the provider request, not only the caller.summarize()(also withstream: true, which now passesabortSignalandtimeoutto the adapter and reports a cancel to middlewareonAbort, notonError), middlewarectx.abort()when the caller passed anabortController(adapter request, structured output, andctx.signal), subagent children,generateVideostatus polls, and abortedtoWebSocketturns now stop when the run is cancelled. -
#1903
13b1ca9- Pass resolved and cancelled MCP input responses to pending server tools when resuming through persistence with an empty incoming message history. -
#1974
09dde65- Report token usage for every call that the provider billed, also when the call fails.- Adapters put the usage that they received on
RUN_ERROR: a cut-off response, a refusal, a parse failure, an empty response, or a stream that fails after usage arrived. Before, many of these paths dropped it. - A non-streaming
structuredOutput(), image, or speech call that fails after the response throws an error with ausagefield.chat(),generateImage(),generateSpeech(), andsummarize()report it. - The
onUsagemiddleware hook now also runs for aRUN_ERRORwith usage. A structured output value that fails the schema check still reports the usage of its call. - Media streams carry
usageonRUN_FINISHEDandRUN_ERROR. Devtools now gets thesummarize:usageandtranscription:usageevents, andtext:usagefor a chatRUN_ERRORwith usage. A call thatonModelErroror a rate-limit retry drops still reports its usage. - Provider fields that were dropped are mapped: Anthropic thinking tokens, Claude Code
total_cost_usdasusage.cost, OpenRouter Responses reasoning tokens, opencode cost and cache writes, ACP and Bedrock cache writes, OpenAI evaluate token details, Gemini Vertex embedding tokens, and audio duration as billed seconds for Whisper, Groq, Cloudflare, and Lovable transcription. - opencode adds up the usage of every agent step in a turn. Before, it counted only the last step.
- Gemini Interactions usage (text, agentic video, and images) counts thought tokens in
completionTokens, the same asgenerateContent.
- Adapters put the usage that they received on
-
Updated dependencies [
e17cae7,09dde65]:- @tanstack/ai-utils@1.0.1
- @tanstack/ai-event-client@1.0.1
@tanstack/ai-vercel-gateway@1.1.0
Minor Changes
Patch Changes
-
#1975
c7f8dfd- AbortinggenerateImage()now stops the Vercel AI Gateway request. Before, the call rejected but the request kept running and was billed. -
#1931
7541699- Report the gateway's debited amount (gatewayCost, which includes surcharges) asusage.costinstead of the inference charge alone. -
Updated dependencies [
9ac67f3,9ac67f3,e17cae7,d6ead13,450950d,07d2e42,13b1ca9,e17cae7,940c402,09dde65]:- @tanstack/ai@1.1.0
- @tanstack/ai-utils@1.0.1
- @tanstack/openai-base@1.0.1