Sambanova
tip
We support ALL Sambanova models, just set model=sambanova/<any-model-on-sambanova> as a prefix when sending litellm requests. For the complete supported model list, visit https://docs.sambanova.ai/cloud/docs/get-started/supported-models 
API Key​
# env variable
os.environ['SAMBANOVA_API_KEY']
Sample Usage​
from litellm import completion
import os
os.environ['SAMBANOVA_API_KEY'] = ""
response = completion(
    model="sambanova/Meta-Llama-3.1-8B-Instruct",
    messages=[
        {
            "role": "user",
            "content": "What do you know about sambanova.ai. Give your response in json format",
        }
    ],
    max_tokens=10,
    response_format={ "type": "json_object" },
    stop=["\n\n"],
    temperature=0.2,
    top_p=0.9,
    tool_choice="auto",
    tools=[],
    user="user",
)
print(response)
Sample Usage - Streaming​
from litellm import completion
import os
os.environ['SAMBANOVA_API_KEY'] = ""
response = completion(
    model="sambanova/Meta-Llama-3.1-8B-Instruct",
    messages=[
        {
            "role": "user",
            "content": "What do you know about sambanova.ai. Give your response in json format",
        }
    ],
    stream=True,
    max_tokens=10,
    response_format={ "type": "json_object" },
    stop=["\n\n"],
    temperature=0.2,
    top_p=0.9,
    tool_choice="auto",
    tools=[],
    user="user",
)
for chunk in response:
    print(chunk)
Usage with LiteLLM Proxy Server​
Here's how to call a Sambanova model with the LiteLLM Proxy Server
- Modify the config.yaml - model_list:
 - model_name: my-model
 litellm_params:
 model: sambanova/<your-model-name> # add sambanova/ prefix to route as Sambanova provider
 api_key: api-key # api key to send your model
- Start the proxy - $ litellm --config /path/to/config.yaml
- Send Request to LiteLLM Proxy Server - OpenAI Python v1.0.0+
- curl
 - import openai
 client = openai.OpenAI(
 api_key="sk-1234", # pass litellm proxy key, if you're using virtual keys
 base_url="http://0.0.0.0:4000" # litellm-proxy-base url
 )
 response = client.chat.completions.create(
 model="my-model",
 messages = [
 {
 "role": "user",
 "content": "what llm are you"
 }
 ],
 )
 print(response)- curl --location 'http://0.0.0.0:4000/chat/completions' \
 --header 'Authorization: Bearer sk-1234' \
 --header 'Content-Type: application/json' \
 --data '{
 "model": "my-model",
 "messages": [
 {
 "role": "user",
 "content": "what llm are you"
 }
 ],
 }'