Skip to main content
Hugging Face is a platform for building, training, and deploying open-source models. You can use SambaNova as an inference provider to access our models through Hugging Face.

Prerequisites

Before starting, ensure you have:

Setup

1

Enable SambaNova as an inference provider

Go to your Hugging Face account settings, navigate to Inference Providers, and enable SambaNova.
Hugging Face inference providers settings with SambaNova enabled
2

Add your SambaCloud API key

Enter your SambaCloud API key in the provider configuration.Get your API key from the SambaCloud portal.
Hugging Face API key configuration for SambaNova

Usage

There are two ways to use Inference APIs:
  • Custom key: Your requests are sent directly to SambaNova using your own API key. Usage is billed to your SambaNova account.
  • Routed by HF: Your requests are routed through Hugging Face, so you don’t need a separate provider API key. Usage fees are billed to your Hugging Face account.

Using the Python SDK

The example below demonstrates how to run a model through SambaNova as the inference provider. You can authenticate with your SambaCloud API key. Make sure you have huggingface_hub version 0.28.0 or newer installed.
from huggingface_hub import InferenceClient

client = InferenceClient(
    provider="sambanova",
    api_key="your-sambanova-api-key"
)

messages = [
    {
        "role": "user",
        "content": "What is the capital of France?"
    }
]

completion = client.chat.completions.create(
    model="Meta-Llama-3.3-70B-Instruct",
    messages=messages,
    max_tokens=500
)

print(completion.choices[0].message)

Additional resources