SambaNova Python SDK
raw JSON → 1.8.2 verified Sat May 09 auth: no python
The official Python library for the SambaNova API. Provides synchronous and asynchronous clients for chat completions, embeddings, audio, responses, and vision. Actively maintained, version 1.8.2, with frequent releases.
pip install sambanova Common errors
error sambanova.lib.SambaNovaError: api_key is required ↓
cause No API key provided.
fix
Set the SAMBANOVA_API_KEY environment variable or pass api_key='your_key' to SambaNovaClient().
error ModuleNotFoundError: No module named 'sambanova' ↓
cause Library not installed.
fix
Run 'pip install sambanova'.
error AttributeError: module 'sambanova' has no attribute 'Client' ↓
cause Wrong import: tried 'from sambanova import Client'.
fix
Use 'from sambanova import SambaNovaClient'.
Warnings
breaking API key must be set either via environment variable SAMBANOVA_API_KEY or passed directly. The library will raise an authentication error if missing. ↓
fix Set os.environ['SAMBANOVA_API_KEY'] or pass api_key argument to SambaNovaClient().
gotcha The model name must match SambaNova's model IDs exactly (e.g., 'Meta-Llama-3.1-8B-Instruct', 'Llama-3.2-11B-Vision-Instruct'). Using a generic OpenAI model name will fail. ↓
fix Refer to SambaNova documentation for exact model IDs.
deprecated Support for Python 3.8 was dropped after version 1.5.0. The library now requires Python >=3.9. ↓
fix Upgrade Python to 3.9 or higher.
Imports
- SambaNovaClient wrong
from sambanova import Clientcorrectfrom sambanova import SambaNovaClient - AsyncSambaNovaClient
from sambanova import AsyncSambaNovaClient
Quickstart
from sambanova import SambaNovaClient
client = SambaNovaClient(
api_key=os.environ.get('SAMBANOVA_API_KEY', ''),
)
try:
response = client.chat.completions.create(
model='Meta-Llama-3.1-8B-Instruct',
messages=[{'role': 'user', 'content': 'Hello'}],
)
print(response.choices[0].message.content)
except Exception as e:
print(f'Error: {e}')