Skip to content

[js] 0.16.2

Choose a tag to compare

@github-actions github-actions released this 15 Feb 13:06
· 373 commits to main since this release

fix: extract usage and finish reason from OpenRouter provider metadata

When using OpenRouter-compatible APIs (like Kilo Gateway), the standard AI SDK usage object may be empty while the actual usage data is in providerMetadata.openrouter.usage. This fix adds fallback logic to extract token counts and finish reason from provider metadata.

This enables accurate token counting and cost calculation for all OpenRouter-compatible providers including Kilo Gateway.

Related Pull Request: #188


npm version