Prerequisites
- A SambaCloud account
- A SambaNova API key
- Node.js 18 or later
Setup
The SambaNova provider is available via thesambanova-ai-provider module. You can install it with:
Environment variables
Create a.env file in your project root:
Provider instance
You can import the default provider instancesambanova from sambanova-ai-provider:
createSambaNova from sambanova-ai-provider and create a provider instance with your settings:
-
baseURL string
Use a different URL prefix for API calls, e.g. to use proxy servers. The default prefix is
https://api.sambanova.ai/v1. -
apiKey string
API key that is being sent using the
Authorizationheader. It defaults to theSAMBANOVA_API_KEYenvironment variable. - headers Record<string,string> Custom headers to include in the requests.
-
fetch (input: RequestInfo, init?: RequestInit) => Promise<Response>
Custom fetch implementation. Defaults to the global
fetchfunction. You can use it as a middleware to intercept requests, or to provide a custom fetch implementation for e.g. testing.
Models
You can use any of the SambaCloud models on a provider instance. The first argument is the model id, e.g.Meta-Llama-3.3-70B-Instruct.
Example usage
Basic demonstration of text generation using the SambaNova provider.Intercepting fetch requests
Intercepting fetch requests is supported. See the Vercel AI SDK example for intercepting fetch requests.Example
Example output
Troubleshooting
Module not found: sambanova-ai-provider
Module not found: sambanova-ai-provider
Run
npm install sambanova-ai-provider (or yarn add / pnpm add). Verify your package manager matches the install command.Model not found or invalid model ID
Model not found or invalid model ID
Check the model ID is correct. See available models for valid IDs.

