Repository navigation
@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