← AI PulseAug 17, 2026

Wire · news · Single-source brief

Vercel AI SDK Updates OpenAI-Compatible Usage Field Preservation

The Vercel AI SDK has been updated to preserve unmapped usage fields within the usage.raw object for OpenAI-compatible providers, addressing an issue where detailed token counts were previously dropped.

By Illumora Editorial

Source · Aug 17, 2026, 6:22 PM · On Illumora · Aug 17, 2026, 6:28 PM

Media from the primary source — shown here so you can stay on Illumora.

Rewritten from one allowlisted primary — not independent enterprise reporting. Lanes →

Brief drafted by Illumora’s editorial model from the linked primary source. Ops desk reviews flagged pieces. How we write →

Read the source →Vercel AI SDK Changelog — Release @ai-sdk/openai-compatible@3.0.31 · vercel/ai
Save

The Vercel AI SDK has released an update, version @ai-sdk/openai-compatible@3.0.31, that modifies how usage fields are handled for OpenAI-compatible models. This patch specifically focuses on preserving detailed usage information that providers return in the usage.raw field.

Previously, while the top-level usage object was parsed loosely, nested objects such as prompt_tokens_details and completion_tokens_details were strict. This strictness caused specific details reported by providers, like audio_tokens, image_tokens, and text_tokens, to be discarded. The update ensures that both nested objects and the completion model's usage schema are now parsed loosely, allowing these distinguishing details to be retained.

Key Points

  • The Vercel AI SDK version @ai-sdk/openai-compatible@3.0.31 was released.
  • The update preserves unmapped usage fields within the usage.raw object.
  • Previously, prompt_tokens_details and completion_tokens_details objects were strictly parsed.
  • This strict parsing led to the loss of provider-specific details such as audio_tokens, image_tokens, and text_tokens.
  • Both nested objects are now parsed loosely, as is the completion model's usage schema.
  • Only the usage.raw field is affected by this change.
  • Mapped token counts remain unaffected.

Context

According to the Vercel AI SDK Changelog, the usage.raw field is intended to reflect usage "in the shape that the provider returns." The previous implementation, despite loosely parsing the main usage object, had strict parsing for nested detail fields, leading to data loss for specific token types.

Why It Matters

This update is significant for developers who rely on detailed usage metrics from OpenAI-compatible providers. By preserving specific token counts like audio_tokens or image_tokens, builders gain a more complete understanding of resource consumption, which can inform cost analysis and model optimization strategies.

What To Do

  • Review the usage.raw field in your applications if you use Vercel AI SDK with OpenAI-compatible providers.
  • Note that audio_tokens, image_tokens, and text_tokens may now be present in usage.raw.
  • Compare the detailed usage information now available to previous logs to understand the impact on your specific use cases.
  • Update your @ai-sdk/openai-compatible package to version 3.0.31 or later to benefit from these changes.