> ## Documentation Index
> Fetch the complete documentation index at: https://sambanova-systems.mintlify.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SambaNova quickstart

Get started using the SambaNova API in just a few minutes.

## Prerequisites

Before you begin, ensure you have:

* A [SambaCloud](https://cloud.sambanova.ai) account, or access to a SambaStack deployment through your system administrator.
* Python 3, Node.js, or curl installed, depending on your preferred integration method.

<Steps>
  <Step title="Get your API key.">
    To generate an API key, go to the [API keys and URLs](/en/get-started/api-keys-urls) page.  When generating API keys, be sure to save them securely, as they can’t be viewed again.

    <Note>
      You can generate and use up to 25 API keys.
    </Note>
  </Step>

  <Step title="Pick a model.">
    SambaCloud developers can view the available models and details on the [SambaCloud model](/en/models/sambacloud-models) page.

    SambaStack developers should consult with their system administrator to determine which models are available on their system. Model details can then be viewed on the [SambaStack models](/en/sambastack/service-administration/supported-models-and-bundles) page.

    <Tip>
      This guide uses `Meta-Llama-3.3-70B-Instruct` as an example for the remainder of these steps.
    </Tip>
  </Step>

  <Step title="Make an API request.">
    You can make an inference request in multiple ways. See two examples below:

    * **SambaNova SDK** - Use Javascript or Python for a more flexible integration.
    * **OpenAI client library** – Use Javascript or Python for a more flexible integration.
    * **CURL command** – Send a request directly from the command line.
  </Step>
</Steps>

## SambaNova SDK

To get started, choose your preferred programming language. Next, open a terminal and run the command to install the SambaNova SDK.

<CodeGroup>
  ```javascript Javascript theme={null}
  //ensure you have Node.js installed.
  npm install sambanova
  ```

  ```python Python theme={null}
  # make sure you have Python3 and pip installed
  pip install sambanova
  ```
</CodeGroup>

Next, copy the following code into a new file.

<CodeGroup>
  ```javascript hello-world.js theme={null}
  import SambaNova from "sambanova";

  const client = new SambaNova({
    baseURL: "your-sambanova-base-url",
    apiKey: "your-sambanova-api-key",
  });

  const chatCompletion = await client.chat.completions.create({
    messages: [
      { role: "system", content: "Answer the question in a couple sentences." },
      { role: "user", content: "Share a happy story with me" },
    ],
    model: "Meta-Llama-3.3-70B-Instruct",
  });

  console.log(chatCompletion.choices[0].message.content);
  ```

  ```python hello_world.py theme={null}
  from sambanova import SambaNova

  client = SambaNova(
      base_url="your-sambanova-base-url",
      api_key="your-sambanova-api-key"
  )

  completion = client.chat.completions.create(
    model="Meta-Llama-3.3-70B-Instruct",
    messages = [
        {"role": "system", "content": "Answer the question in a couple sentences."},
        {"role": "user", "content": "Share a happy story with me"}
      ]
  )

  print(completion.choices[0].message.content)
  ```
</CodeGroup>

After copying the code into the file, replace the placeholder strings `"your-sambanova-base-url"` and `"your-sambanova-api-key"` with your actual Base URL and API Key. Then, run the file in a terminal using the command shown below.

<CodeGroup>
  ```javascript Javascript theme={null}
  node hello-world.js
  ```

  ```python Python theme={null}
  python hello_world.py
  ```
</CodeGroup>

After running the program, you'll see output similar to the following:

```
Here’s a happy story: One day, a little girl named Sophie found a lost puppy in her neighborhood and decided to take it home to care for it. As she nursed the puppy back to health, she named it Max and the two became inseparable best friends, going on adventures and playing together every day.
```

## OpenAI client library

To get started, select your preferred programming language. Then, open a terminal window and run the command to install the OpenAI library.

<CodeGroup>
  ```javascript Javascript theme={null}
  //ensure you have Node.js installed.
  npm install openai
  ```

  ```python Python theme={null}
  # make sure you have Python3 and pip installed
  pip install openai
  ```
</CodeGroup>

Next, copy the following code into a  new file.

<CodeGroup>
  ```javascript hello-world.js theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    baseURL: "your-sambanova-base-url",
    apiKey: "your-sambanova-api-key",
  });

  const chatCompletion = await client.chat.completions.create({
    messages: [
      { role: "system", content: "Answer the question in a couple sentences." },
      { role: "user", content: "Share a happy story with me" },
    ],
    model: "Meta-Llama-3.3-70B-Instruct",
  });

  console.log(chatCompletion.choices[0].message.content);
  ```

  ```python hello_world.py theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="your-sambanova-base-url",
      api_key="your-sambanova-api-key"
  )

  completion = client.chat.completions.create(
    model="Meta-Llama-3.3-70B-Instruct",
    messages = [
        {"role": "system", "content": "Answer the question in a couple sentences."},
        {"role": "user", "content": "Share a happy story with me"}
      ]
  )

  print(completion.choices[0].message.content)
  ```
</CodeGroup>

Once copied into the file, replace the string fields `"your-sambanova-base-url"` and `"your-sambanova-api-key"` with your base URL and API Key values. Then run the file with the command below in a terminal window.

<CodeGroup>
  ```javascript Javascript theme={null}
  node hello-world.js
  ```

  ```python Python theme={null}
  python hello_world.py
  ```
</CodeGroup>

After you run the program, you'll see output similar to the following:

```
Here’s a happy story: One day, a little girl named Sophie found a lost puppy in her neighborhood and decided to take it home to care for it. As she nursed the puppy back to health, she named it Max and the two became inseparable best friends, going on adventures and playing together every day.
```

## CURL command

In a terminal window, run the CURL command to make your first request to the API.

```sh theme={null}
export API_KEY="your-api-key-here"
export URL="your-url-here"

curl -H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
],
"stop": ["<|eot_id|>"],
"model": "Meta-Llama-3.3-70B-Instruct",
"stream": true, "stream_options": {"include_usage": true}
}' \
-X POST $URL
```

## Next steps

Now that you can make requests to a model, great potential of building AI-powered applications  await. Get inspired of what to build  by exploring the [AI Starter Kits](/en/build/ai-starter-kits), a collection of open-source Python projects.
