Skip to content

@tanstack/openai-base@1.0.1

Choose a tag to compare

@github-actions github-actions released this 04 Nov 13:59
· 52 commits to main since this release
Immutable release. Only release title and notes can be modified.
d82a6ed

Patch Changes

  • #1966 e17cae7 - Stop the OpenAI Responses adapters from aborting a finished request. After response.completed the 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 streamed apply_patch call to the app. The Responses API adds an apply_patch_call with status: "in_progress" and an empty diff, and streams the diff in before the item is done. The adapter ended the call when the item was added, so execute always got diff: "", 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 (code incomplete-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 a usage field. chat(), generateImage(), generateSpeech(), and summarize() report it.
    • The onUsage middleware hook now also runs for a RUN_ERROR with usage. A structured output value that fails the schema check still reports the usage of its call.
    • Media streams carry usage on RUN_FINISHED and RUN_ERROR. Devtools now gets the summarize:usage and transcription:usage events, and text:usage for a chat RUN_ERROR with usage. A call that onModelError or a rate-limit retry drops still reports its usage.
    • Provider fields that were dropped are mapped: Anthropic thinking tokens, Claude Code total_cost_usd as usage.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 as generateContent.
  • Updated dependencies [9ac67f3, 9ac67f3, e17cae7, d6ead13, 450950d, 07d2e42, 13b1ca9, 09dde65]:

    • @tanstack/ai@1.1.0
    • @tanstack/ai-utils@1.0.1