tweak: include usage by default for openai compatible providers

This commit is contained in:
rekram1-node 2025-09-25 21:02:57 -05:00
parent 8f135d13e3
commit 0403750a27

View file

@ -338,6 +338,9 @@ export namespace Provider {
const s = await state()
const pkg = model.provider?.npm ?? provider.npm ?? provider.id
const options = { ...s.providers[provider.id]?.options }
if (pkg.includes("@ai-sdk/openai-compatible") && options["includeUsage"] === undefined) {
options["includeUsage"] = true
}
const key = Bun.hash.xxHash32(JSON.stringify({ pkg, options }))
const existing = s.sdk.get(key)
if (existing) return existing