Unified.to
All articles

How to Get a Groq API Key and Connect It to Your Product

·

To get a Groq API key, sign up at console.groq.com, select a project, open API Keys (console.groq.com/keys) and click Create API Key. Then call https://api.groq.com/openai/v1 with the key as a Bearer token. Groq has a Free plan, so you can create a key and make calls before adding a payment method. As of 4 November 2026, openai/gpt-oss-120b and openai/gpt-oss-20b are the production text models available on it.

Looking for Grok (with a k), xAI's models? That's a different company with a different key: see How to Get a Grok API Key (xAI).

What is a Groq API key?

A Groq API key is the credential GroqCloud uses to authenticate API requests. Each key belongs to one project inside your Groq organization, and rate limits apply to the organization as a whole. Groq is an inference platform: it runs open-weight models such as OpenAI's gpt-oss and Whisper on its own LPU (Language Processing Unit) hardware. It doesn't run OpenAI's proprietary GPT models, Claude or Gemini.

How to get a Groq API key

  1. Create an account at https://console.groq.com.
  2. Pick a project. Keys are scoped to the project you have selected, so choose or create the right one first. Only the Owner and Developer roles can manage keys; the Reader role is read-only.
  3. Create the key. Go to API Keys (console.groq.com/keys), click Create API Key, and name it for where it will run (prod-api, ci-pipeline).
  4. Copy the key when it's shown and store it in a secrets manager. If you lose it, revoke it and create a new one.

How do you store and test a Groq API key?

Groq's quickstart sets the key as the GROQ_API_KEY environment variable:

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

Keep it in a secrets manager in production, never in Git or chat.

Test it:

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": "Reply with the word ok."}]
  }'

Use openai/gpt-oss-120b or openai/gpt-oss-20b, not the model in Groq's own quickstart. As of 4 November 2026, the quickstart example still uses llama-3.3-70b-versatile, which Groq shut down for free and developer tiers on 16 August 2026 and now lists as Enterprise only.

Is the Groq API free?

Yes. Groq has a Free plan, and its billing FAQ asks for a payment method only when you upgrade from Free to Developer. Free-plan limits are set per model; your organization's exact limits are on the Limits page in your Groq account settings.

The Developer plan adds higher token limits, chat support, the Flex service tier, Batch processing, and Spend Limits with usage alerts. It's pay-as-you-go, billed monthly in arrears. New Developer accounts are also charged when cumulative usage crosses $1, $10, $100, $500 and $1,000, and Groq doesn't bill amounts under $0.50. You can downgrade to Free at any time after paying for unbilled usage.

How much does the Groq API cost?

Production models on Groq's Models page, checked 4 November 2026:

ModelSpeedContextPrice
openai/gpt-oss-20b~1,000 tokens/s131,072$0.075 input / $0.30 output per 1M tokens
openai/gpt-oss-120b~500 tokens/s131,072$0.15 input / $0.60 output per 1M tokens
whisper-large-v3n/an/a$0.111 per hour of audio
whisper-large-v3-turbon/an/a$0.04 per hour of audio
llama-3.1-8b-instant and llama-3.3-70b-versatile remain production models for Enterprise customers only, priced through sales. Preview models such as qwen/qwen3.8-27b are for evaluation; Groq says they may be discontinued at short notice.

Which Groq models were deprecated in 2026?

For free and developer-tier usage, Groq shut down these models in 2026 (Enterprise committed-spend contracts aren't affected):

ModelShut downGroq's replacement
llama-3.3-70b-versatile16 Aug 2026openai/gpt-oss-120b
llama-3.1-8b-instant16 Aug 2026openai/gpt-oss-20b
meta-llama/llama-4-scout-17b-16e-instruct17 Jul 2026openai/gpt-oss-120b
qwen/qwen3-32b17 Jul 2026openai/gpt-oss-120b
If calls that used to work now return 404 or a model error, check the model ID against Groq's Models page first.

How do you switch from OpenAI to Groq?

Groq's API is OpenAI-compatible. Change the key and the base URL:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["GROQ_API_KEY"],
    base_url="https://api.groq.com/openai/v1",
)

response = client.chat.completions.create(
    model="openai/gpt-oss-120b",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)

Groq returns a 400 if you send logprobs, logit_bias, top_logprobs or messages[].name, and n must be 1. Remove those parameters from code you port.

What are the Groq API rate limits?

Groq applies rate limits to your organization, not to individual users. Each model has limits for requests per minute and per day (RPM, RPD), tokens per minute and per day (TPM, TPD), and, for speech models, audio seconds per hour and per day (ASH, ASD). You hit whichever comes first. Cached tokens don't count.

  • Project limits: you can set per-model limits for a project, but only equal to or lower than the organization's.
  • Headers: x-ratelimit-limit-requests and x-ratelimit-remaining-requests refer to the daily request limit (RPD); the -tokens headers refer to TPM.
  • On 429: wait the number of seconds in the retry-after header, which Groq sends only with a 429.

What are Groq service tiers?

Set service_tier on a request to choose how it's scheduled:

  • on_demand: the default, with standard rate limits
  • flex: for paid customers; 10x the on-demand rate limits, best effort. When capacity runs out it fails fast with 498 capacity_exceeded, so retry with jittered backoff.
  • performance: the most reliable low latency; available to enterprise customers
  • auto: Groq picks the tier

How do you fix common Groq API errors?

  • 400: an unsupported OpenAI parameter (see above) or a malformed request.
  • 401 Unauthorized: the key is missing, revoked or copied incorrectly. Check the Authorization: Bearer $GROQ_API_KEY header.
  • 404 Not Found: the model ID or URL is wrong, or the model was deprecated for your plan.
  • 413 Request Entity Too Large: reduce the request size.
  • 422 Unprocessable Entity: the request is well-formed but can't be processed; check the input and retry.
  • 429 Too Many Requests: you've hit a rate limit; wait for retry-after.
  • 498 Flex Tier Capacity Exceeded: flex is at capacity; retry with jittered backoff or use on_demand.
  • 500, 502, 503: server-side errors. Retry later. Groq doesn't charge for these.

Using Groq through Unified.to

Unified.to's Generative AI API puts Groq behind the same request shape as its other AI integrations. You integrate once and switch providers by changing the connection ID, not your application code.

As of 2 November 2026, Unified.to's Groq integration supports:

  • Model: list and get models, with max tokens and temperature support
  • Prompt: create a prompt with messages, temperature and max tokens; returns responses and tokens used
  • File: list, get and remove files stored in Groq (File Storage category)

A Prompt also accepts mcp_url, a remote MCP URL that is sent to the LLM API so the model can call that server's tools. Groq documents remote MCP support for its tool-use models, including gpt-oss.

Letting Groq act on your customers' SaaS data with Unified MCP

Unified.to's MCP server exposes a customer's connection as tools. Server URLs by region:

  • US: https://mcp-api.unified.to/mcp
  • EU: https://mcp-api-eu.unified.to/mcp
  • AU: https://mcp-api-au.unified.to/mcp

Keep the tool list short. Unified.to's MCP docs note that Groq's models can only handle 10 tools at a time, so narrow the list with tools (wildcards work, for example list_*) or permissions (for example crm_contact_read) before you pass it to the model.

For function calling with Groq:

  1. Fetch the tools in Groq's format: GET /tools?type=groq. Each tool comes back as { type: "function", function: { name, description, parameters } }, the shape Groq's OpenAI-compatible API expects.
  2. Pass them in the tools array of your Groq request.
  3. When the model returns a tool call, run it with POST /tools/{id}/call, with the arguments as the JSON body.
  4. Send the result back as a role: "tool" message.

Add hide_sensitive=true to the call URL to remove PII fields such as names, emails and phone numbers from tool results. Each tool call counts as one API request on your Unified.to plan.

Start your 30-day free trial · Book a demo

FAQ

Can I run GPT-4, Claude or Gemini on Groq? No. Groq runs open-weight models only, such as OpenAI's gpt-oss and Whisper. For proprietary models, use each provider's own API.

Why does llama-3.3-70b-versatile fail on my Groq key? Groq shut it down for free and developer tiers on 16 August 2026, and it's now Enterprise only. Use openai/gpt-oss-120b.

What's the difference between Groq and Grok? Groq (with a q) runs open-weight models on its own LPU hardware at api.groq.com. Grok (with a k) is xAI's model family at api.x.ai. They have separate keys and separate billing. See How to Get a Grok API Key (xAI).

All articles