> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptguard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Groq

> Scan Groq traffic through the PromptGuard proxy with any OpenAI client

## Proxy

> [!NOTE]
>
> **Proxy Base URL:** `https://api.promptguard.co/api/v1`
>
> Point your LLM SDK's `base_url` / `baseURL` to this endpoint. Your existing provider API key goes in the `Authorization` header as usual; add your PromptGuard key via `X-API-Key`.

Groq is checked before Hugging Face and OpenAI, so it gets every model id starting `llama-3`, `llama-4`, `llama3-`, `meta-llama/`, `qwen/`, `qwen-`, `openai/`, `moonshotai/`, `canopylabs/`, `whisper-`, `distil-whisper-`, `playai-`, `groq/`, `gemma` or `mixtral-`. That includes `meta-llama/` and `qwen/` ids you may have meant for Hugging Face.

Groq speaks OpenAI's wire format, so PromptGuard forwards your request to `api.groq.com/openai/v1` as you sent it and returns Groq's reply unchanged. Any OpenAI client works.

```python Python theme={"system"}
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.promptguard.co/api/v1",
    api_key=os.environ["GROQ_API_KEY"],  # forwarded to Groq
    default_headers={"X-API-Key": os.environ["PROMPTGUARD_API_KEY"]},
)

response = client.chat.completions.create(
    model="llama-3.3-70b-versatile",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
```

```typescript Node.js theme={"system"}
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.promptguard.co/api/v1',
  apiKey: process.env.GROQ_API_KEY, // forwarded to Groq
  defaultHeaders: { 'X-API-Key': process.env.PROMPTGUARD_API_KEY },
});

const response = await client.chat.completions.create({
  model: 'llama-3.3-70b-versatile',
  messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.choices[0].message.content);
```

```bash cURL theme={"system"}
curl https://api.promptguard.co/api/v1/chat/completions \
  -H "X-API-Key: $PROMPTGUARD_API_KEY" \
  -H "Authorization: Bearer $GROQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "llama-3.3-70b-versatile", "messages": [{"role": "user", "content": "Hello!"}]}'
```

Groq keys cannot be [stored as provider keys](https://docs.promptguard.co/gateway/provider-keys.md) yet, so send yours in `Authorization` on every request.

## Auto-instrumentation

The SDKs do not patch `groq`. Python's `init()` names it in its startup warning when it is installed, so you know its calls are not scanned. Use the proxy.

## Next steps

> [card] [Provider keys](https://docs.promptguard.co/gateway/provider-keys.md)
>
> Store your provider credentials once, forwarded server-side

> [card] [Fallback models](https://docs.promptguard.co/gateway/fallback-models.md)
>
> Models to try when the one you asked for is down

> [card] [Integrations overview](https://docs.promptguard.co/integrations/overview.md)
>
> Every provider and framework, and how to connect each


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.