Support for Vercel's ai-sdk

Vercel launched ai sdk which is a wrapper on top of the existing openai package. Can we use that for building our hackathon submission? I have tested out SambaNova endpoint and it works well with it, just wanted to clarify if the usage is limited to the openai sdk

Vercel AI SDK - ai - npm

4 Likes

This seems an essential to have to get more adoption

1 Like

Not sure why this never got replied to but the answer is yes you can use this.
-Coby

OpenAPI with base URL changes works for basic REST calls, but dedicated AI SDKs provide critical features like proper typing, streaming support, specialized error handling, and helper utilities that you’d otherwise need to build yourself.

Took a while but it happened: SambaNova provider for Vercel AI SDK

That’s good news, I’ve added support for SambaNova now to https://typedai.dev using the vercel ai package.

Description

We’re using the Vercel AI SDK with SambaNova and streamText method. When calling streamText with DeepSeek model, we’re getting NaN values for token usage in onFinish callback.

Here’s the code we’re using:

const result = streamText({
    model,
    messages,
    onFinish({ usage }) {
      console.log(usage)
    }
  })

The output looks like this:

{ promptTokens: NaN, completionTokens: NaN, totalTokens: NaN }

We expected to see valid token usage values. Any insights into why this is happening?

Okay I found the issue and fixed it. I have requested PR in github.