Cloudflare Docs
AI Gateway
Edit this page on GitHub
Set theme to dark (⇧+D)


When making requests to Groq, replace in the URL you’re currently using with{account_id}/{gateway_slug}/groq.

Example fetch request
curl -X POST{account_id}/{gateway_slug}/groq/chat/completions \
--header 'Authorization: Bearer {groq_api_key}' \
--header 'Content-Type: application/json' \
--data '{
"messages": [
"role": "user",
"content": "What is Cloudflare?"
"model": "mixtral-8x7b-32768"

If using the groq-sdk, set your endpoint like this:

import Groq from 'groq-sdk';
const groq = new Groq({
apiKey: env.GROQ_API_KEY,
baseURL: "{account_id}/{gateway_slug}/groq"
const chatCompletion = await{
messages: [{ role: 'user', content: 'What is Cloudflare?' }],
model: 'mixtral-8x7b-32768',