Find an API

Search public APIs with auth details & Postman guides

← All APIs

Groq API

api.groq.com · AI

AI Bearer Token Free Tier AI LLM Inference

Ultra-fast LLM inference via custom LPU hardware — run LLaMA, Mistral, Gemma at 500+ tokens/second. OpenAI-compatible API. Generous free tier.

Authentication

Bearer Token Free API key at console.groq.com. Pass as Authorization: Bearer YOUR_KEY.

Sample Requests

POST Fast chat completion

Get an ultra-fast LLaMA 3 response.

https://api.groq.com/openai/v1/chat/completions

Hover any highlighted part to learn what it does

Headers — extra info sent with the request
Content-Type application/json
Authorization Bearer YOUR_KEY
Request Body — data you're sending
{
  "model": "llama3-8b-8192",
  "messages": [
    {
      "role": "user",
      "content": "What is LPU hardware?"
    }
  ]
}
curl -X POST "https://api.groq.com/openai/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"llama3-8b-8192","messages":[{"role":"user","content":"What is LPU hardware?"}]}'
import requests
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
data = {
    "model": "llama3-8b-8192",
    "messages": [
        {
            "role": "user",
            "content": "What is LPU hardware?"
        }
    ]
}
response = requests.post(
    "https://api.groq.com/openai/v1/chat/completions",
    headers=headers,
    json=data,
)
print(response.json())
const url = 'https://api.groq.com/openai/v1/chat/completions';

const response = await fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  },
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "model": "llama3-8b-8192",
  "messages": [
    {
      "role": "user",
      "content": "What is LPU hardware?"
    }
  ]
}),
}); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"bytes"
	"encoding/json"
)

func main() {
	targetURL := "https://api.groq.com/openai/v1/chat/completions"
	jsonData, _ := json.Marshal({"model":"llama3-8b-8192","messages":[{"role":"user","content":"What is LPU hardware?"}]})
	req, _ := http.NewRequest("POST", targetURL, bytes.NewBuffer(jsonData))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.groq.com/openai/v1/chat/completions")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Post.new(uri)
req["Content-Type"] = "application/json"
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
req["Content-Type"] = "application/json"
req.body = "{\"model\":\"llama3-8b-8192\",\"messages\":[{\"role\":\"user\",\"content\":\"What is LPU hardware?\"}]}"

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.groq.com/openai/v1/chat/completions";
$opts = ["http" => [
    "method" => "POST",
    "header" => implode("\r\n", [
        "Content-Type: application/json",
        "Authorization: Bearer YOUR_ACCESS_TOKEN",
        "Content-Type: application/json"
    ]),
    "content" => json_encode({"model":"llama3-8b-8192","messages":[{"role":"user","content":"What is LPU hardware?"}]}),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Get a free API key at console.groq.com
  2. Set Authorization: Bearer YOUR_KEY
  3. Fully OpenAI-compatible — works as a drop-in replacement
  4. Models: llama3-8b-8192, llama3-70b-8192, mixtral-8x7b-32768, gemma-7b-it
  5. Free tier: 30 requests/minute, 14,400/day

Open documentation ↗