To get a Groq API key, create an account at console.groq.com, open the API Keys page at console.groq.com/keys, create a key and save it as the GROQ_API_KEY environment variable. The key is free, and Groq's Free plan lets you call the API without a payment method, inside fixed request and token limits. This guide covers setup, a first request, what the Free plan allows, per-token pricing on the Developer plan, rate limits, and the errors people hit most often.
What the Groq API Is
Groq is an inference company. It does not train its own chat models. It runs open models from other labs on its own hardware and sells access through GroqCloud, with speed as the selling point: Groq lists about 500 tokens per second for GPT OSS 120B and about 1,000 for GPT OSS 20B.
Groq is not Grok. Grok is the model family from SpaceXSI, formerly xAI, and it uses a different console and a different key. If that is what you wanted, see our Grok API guide.
How to Get a Groq API Key
Step 1: Create a GroqCloud account. Sign up at console.groq.com. New accounts start on the Free plan, and Groq only asks for a payment method when you upgrade to the Developer plan.
Step 2: Pick a project. Keys belong to the project selected in the console's project dropdown. If you plan to separate staging from production, create the projects first so each key lands in the right one.
Step 3: Create the key. Open console.groq.com/keys and create a key. Groq keys start with gsk_. Copy it straight into a secrets manager or a local .env file that is not committed.
Step 4: Set the environment variable. Groq's SDKs read GROQ_API_KEY by default.
export GROQ_API_KEY="gsk_your_key_here"
Step 5: Make a test call. Use the examples in the next section. You can also try models in the console Playground before writing code.
Groq's security guidance is short: never hardcode keys or ship them in frontend code, use a separate key per environment, rotate them periodically, and revoke a key from the console as soon as you suspect it has leaked.
This video walks through creating a Groq account and generating a key in the console.
Your First Groq API Call
The API lives at https://api.groq.com/openai/v1 and takes the key as a Bearer token. Here is a chat completion with curl:
curl https://api.groq.com/openai/v1/chat/completions \
-H "Authorization: Bearer $GROQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-oss-120b",
"messages": [
{ "role": "user", "content": "Explain what an API key is in one sentence." }
]
}'
And the same request in Python, after running pip install groq:
import os
from groq import Groq
client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
completion = client.chat.completions.create(
model="openai/gpt-oss-120b",
messages=[
{"role": "user", "content": "Explain what an API key is in one sentence."}
],
)
print(completion.choices[0].message.content)
Groq describes its API as mostly compatible with OpenAI's client libraries. To reuse existing OpenAI SDK code, set the base URL to https://api.groq.com/openai/v1 and pass your Groq key. A few fields are not supported and return a 400, including logprobs, logit_bias and any n other than 1.
Use a current model ID. Many tutorials, and Groq's own quickstart, still show llama-3.3-70b-versatile. Groq's deprecations page says that model and llama-3.1-8b-instant were shut down for Free and Developer accounts on August 16, 2026, and are now for enterprise customers with a committed-spend contract. Groq's suggested replacements are openai/gpt-oss-120b and openai/gpt-oss-20b.
Is Groq Free?
Partly. The key costs nothing, and the Free plan gives real API access without a card. What you get is capped per model by requests and tokens. On GPT OSS 120B, the Free plan allows 30 requests per minute, 1,000 requests per day, 8,000 tokens per minute and 200,000 tokens per day.
The token caps are what you will hit first. A request with a 3,000-token prompt and a 700-token reply fits about twice a minute and about 54 times a day. That is enough for a demo or a personal tool, not for a batch job or real traffic.
Upgrading to Developer needs a credit card, US bank account or SEPA debit. There is no charge at upgrade; pricing is pay-as-you-go per token. The Free plan also leaves out spend limits, Batch and Flex processing, and chat support. You can downgrade again at any time after paying a final invoice.
On startup credits: Groq's billing FAQ says it occasionally offers promotional credits, such as during hackathons and special events. We could not find a standing startup credit program on Groq's site as of November 2026. For free tiers at other providers, see our free AI API comparison.
Groq API Pricing
On the Developer plan, usage is billed per million tokens. These are the rates in Groq's model docs as of November 2026:
| Model ID | Status | Speed | Input / 1M | Output / 1M |
|---|---|---|---|---|
| openai/gpt-oss-120b | Production | ~500 tokens/sec | $0.15 | $0.60 |
| openai/gpt-oss-20b | Production | ~1,000 tokens/sec | $0.075 | $0.30 |
| qwen/qwen3.8-27b | Preview | ~450 tokens/sec | $0.80 | $4.00 |
| openai/gpt-oss-safeguard-20b | Preview | ~1,000 tokens/sec | $0.075 | $0.30 |
All four have a 131,072-token context window. Speech-to-text is billed by audio length: whisper-large-v3 costs $0.111 per hour and whisper-large-v3-turbo $0.04 per hour. Four other models, including llama-3.3-70b-versatile and llama-3.1-8b-instant, are marked Enterprise with contact-sales pricing. Groq says preview models are for evaluation and can be discontinued at short notice.
For a sense of scale, triaging 10,000 support tickets at 3,000 input and 700 output tokens each on openai/gpt-oss-120b costs about $8.70. The same job through the Batch API costs about $4.35.
Ways to change the bill:
| Option | Effect | Notes |
|---|---|---|
| Prompt caching | 50% off cached input tokens | Automatic on supported models; cached tokens do not count toward rate limits |
| Batch API | 50% off | Asynchronous, with a 24-hour to 7-day window; does not stack with caching |
| Flex processing | Same price, 10x rate limits | Paid accounts only; fails fast with a 498 when capacity is short |
How billing works. Groq invoices monthly in arrears. New Developer accounts are also charged the moment cumulative usage first crosses $1, $10, $100, $500 and $1,000, after which billing is monthly only. Paid accounts can set a monthly spend limit under Settings, Billing, Limits. Spend tracking runs 10 to 15 minutes behind, so a busy app can overshoot the cap slightly.
Groq Rate Limits
Limits apply to your whole organization, not to each key or user, and you are stopped by whichever limit you reach first. These are the base limits in Groq's docs as of November 2026:
| Model | Free: requests | Free: tokens | Developer |
|---|---|---|---|
| openai/gpt-oss-120b | 30/min, 1,000/day | 8,000/min, 200,000/day | 1,000 requests/min, 250,000 tokens/min |
| openai/gpt-oss-20b | 30/min, 1,000/day | 8,000/min, 200,000/day | 1,000 requests/min, 250,000 tokens/min |
| qwen/qwen3.8-27b | 30/min, 1,000/day | 8,000/min, 200,000/day | 1,000 requests/min, 250,000 tokens/min |
| openai/gpt-oss-safeguard-20b | 3/min, 1,000/day | 2,000/min, 200,000/day | 1,000 requests/min, 150,000 tokens/min |
| whisper-large-v3 | 20/min, 2,000/day | 7,200 audio seconds/hour, 28,800/day | 300 requests/min, 200,000 audio seconds/hour |
Your exact limits are on the Limits page in the console, and Groq says higher limits are available for select workloads and enterprise customers. Every response carries x-ratelimit headers. Note that the request headers track your daily request count and the token headers track tokens per minute. A retry-after header, in seconds, appears only on a 429.
Common Groq API Errors
| Error | What it means | Fix |
|---|---|---|
| 401 Unauthorized | The key is missing or invalid | Check that GROQ_API_KEY is set in the process making the call and that the key has not been revoked |
| 429 Too Many Requests | You passed a request or token limit | Wait for the retry-after value, shorten prompts, or upgrade to Developer |
| Error on a model ID that used to work | The model was deprecated; requests to retired IDs return errors | Switch to a current ID such as openai/gpt-oss-120b |
| 400 with code blocked_api_access | Your organization reached its monthly spend limit | Raise the limit or wait for the reset on the 1st of the month |
| 413 Request Entity Too Large | The request body is too large | Trim the prompt or split the job |
| 498 Flex Tier Capacity Exceeded | Flex capacity is full | Retry with backoff, or send the request on the default tier |
Groq does not charge for requests that fail with a 500, 502 or 503 server error.
Frequently Asked Questions
How do I get a Groq API key?
Create an account at console.groq.com, open console.groq.com/keys and create a key. Store it as an environment variable called GROQ_API_KEY. You do not need a payment method to create a key or to use the Free plan.
Is the Groq API free?
The key is free and the Free plan needs no card, but usage is capped. As of November 2026, GPT OSS 120B on the Free plan allows 30 requests per minute, 1,000 requests per day, 8,000 tokens per minute and 200,000 tokens per day. Beyond that you upgrade to the Developer plan and pay per token.
How much does the Groq API cost?
As of November 2026, openai/gpt-oss-120b costs $0.15 per million input tokens and $0.60 per million output tokens, and openai/gpt-oss-20b costs $0.075 and $0.30. Cached input tokens are 50% off, and the Batch API is 50% off for asynchronous work.
What are the Groq free tier rate limits?
They vary by model. The main chat models allow 30 requests per minute, 1,000 requests per day, 8,000 tokens per minute and 200,000 tokens per day. Whisper allows 20 requests per minute and 7,200 audio seconds per hour. Limits apply to the whole organization, and the console Limits page shows your exact values.
Are Groq and Grok the same thing?
No. Groq is an inference company that runs open models on its own hardware. Grok is the model family from SpaceXSI, formerly xAI. They have separate consoles, separate pricing and separate API keys.
Can I use the OpenAI SDK with Groq?
Yes. Set the base URL to https://api.groq.com/openai/v1 and pass your Groq key. Groq calls its API mostly OpenAI compatible. A few fields, such as logprobs and logit_bias, are not supported and return a 400 error.
Why does llama-3.3-70b-versatile no longer work on Groq?
Groq deprecated llama-3.3-70b-versatile and llama-3.1-8b-instant for Free and Developer accounts on August 16, 2026. Groq recommends openai/gpt-oss-120b in place of the 70B model and openai/gpt-oss-20b in place of the 8B model.
Does Groq store my prompts?
Groq says that by default it does not retain customer data for inference requests. Data is kept when a feature needs it, such as batch jobs, whose files are retained for 30 days unless you delete them, or when needed to investigate failures or abuse. You can change these settings under Data Controls in the console.
Next Steps
Create the account, generate a key and run the curl example against openai/gpt-oss-120b. Stay on the Free plan while you prototype, and set a spend limit on the day you upgrade. If you are comparing providers, we have matching guides for the OpenAI API key, the Anthropic API key, the Gemini API key, the Grok API and the DeepSeek API, plus a comparison of free AI APIs.