Empowering businesses with cutting-edge solutions in AI, application development, Consulting and testing services....

Quick start of groq cloud

In order to quick start with Groq cloud need to first 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.

GROQ CLOUD

12/27/20241 min read

sea of clouds
sea of clouds

Introduction to Groq Cloud

Quickstart

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

Create an API Key

Please visit here 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:

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

Requesting your first chat completion using Python

Install the Groq Python library:

pip install groq

Performing a Chat Completion:

import os

from groq import Groq

client = Groq(

api_key=os.environ.get("GROQ_API_KEY"),

)

chat_completion = client.chat.completions.create(

messages=[

{

"role": "user",

"content": "Explain the importance of fast language models",

}

],

model="llama3-8b-8192",

)

print(chat_completion.choices[0].message.content)

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