# Quickstart

Get up and running with the Groq API in a few minutes, with the steps below.

For additional support, catch our [onboarding video](/docs/overview).

## Create an API Key

Please visit [here](/keys) to create an API Key.

## Set up your API Key (recommended)

Configure your API key as an environment variable. This approach streamlines your API usage by eliminating the need to include your API key in each request. Moreover, it enhances security by minimizing the risk of inadvertently including your API key in your codebase.

### In your terminal of choice:

```shell
export GROQ_API_KEY=<your-api-key-here>
```

## Requesting your first chat completion

### Execute this curl command in the terminal of your choice:

```shell
# (example shell script)
```

### Install the Groq JavaScript library:

```shell
# (example shell script)
```

### Performing a Chat Completion:

```js
// (example JavaScript code)
```

### Install the Groq Python library:

```shell
# (example shell script)
```

### Performing a Chat Completion:

```python
# (example Python code)
```

### Pass the following as the request body:

```json
// (example JSON data)
```

## Using third-party libraries and SDKs

### Using AI SDK:

[AI SDK](https://ai-sdk.dev/) is a Javascript-based open-source library that simplifies building large language model (LLM) applications. Documentation for how to use Groq on the AI SDK [can be found here](https://console.groq.com/docs/ai-sdk/).

<br />

First, install the `ai` package and the Groq provider `@ai-sdk/groq`:

<br />

```shell
pnpm add ai @ai-sdk/groq
```

<br />

Then, you can use the Groq provider to generate text. By default, the provider will look for `GROQ_API_KEY` as the API key.

<br />

```js
// (example JavaScript code)
```

### Using LiteLLM:

[LiteLLM](https://www.litellm.ai/) is both a Python-based open-source library, and a proxy/gateway server  that simplifies building large language model (LLM) applications. Documentation for LiteLLM [can be found here](https://docs.litellm.ai/).

<br />

First, install the `litellm` package:

<br />

```python
pip install litellm
```

<br />

Then, set up your API key:

<br />

```python
export GROQ_API_KEY="your-groq-api-key"
```

<br />

Now you can easily use any model from Groq. Just set `model=groq/<any-model-on-groq>` as a prefix when sending litellm requests.

<br />

```python
# (example Python code)
```

### Using LangChain:

[LangChain](https://www.langchain.com/) is a framework for developing reliable agents and applications powered by large language models (LLMs). Documentation for LangChain [can be found here for Python](https://python.langchain.com/docs/introduction/), and [here for Javascript](https://js.langchain.com/docs/introduction/).

<br />

When using Python, first, install the `langchain` package:

<br />

```python
pip install langchain-groq
```

<br />

Then, set up your API key:

<br />

```python
export GROQ_API_KEY="your-groq-api-key"
```

<br />

Now you can build chains and agents that can perform multi-step tasks. This chain combines a prompt that tells the model what information to extract, a parser that ensures the output follows a specific JSON format, and llama-3.3-70b-versatile to do the actual text processing.

<br />

```python
# (example Python code)
```

Now that you have successfully received a chat completion, you can try out the other endpoints in the API.

### Next Steps

- Check out the [Playground](/playground) to try out the Groq API in your browser
- Join our GroqCloud [developer community](https://community.groq.com/)
- Add a how-to on your project to the [Groq API Cookbook](https://github.com/groq/groq-api-cookbook)

---

## Structured Outputs: Email Classification (py)