Groq
Route your Groq API calls through AI SpendOps for automatic usage tracking and cost attribution.
Configuration
| Setting | Value |
|---|---|
| Route | /v1/groq/* |
| Upstream | https://api.groq.com/openai |
| Auth header | Authorization: Bearer gsk_... |
| Streaming usage | Auto-injected (stream_options.include_usage) |
SDK base URL
https://proxy.aispendops.com/v1/groq/v1
Example
curl https://proxy.aispendops.com/v1/groq/v1/chat/completions \
-H "Authorization: Bearer gsk_your-groq-key" \
-H "X-ASO-API-Key: aso_k_yourkey.secret" \
-H "Content-Type: application/json" \
-d '{"model":"llama-3.3-70b-versatile","messages":[{"role":"user","content":"Hello"}]}'
Usage fields
| Field | Description |
|---|---|
prompt_tokens | Input tokens |
completion_tokens | Output tokens |
Why the headline rate can mislead
Groq is usually picked for a low per-token price alongside very fast inference, and for output-heavy work that is exactly what you get. The comparison gets less obvious for prompt-heavy workloads, because Groq does not offer prompt caching.
Consider an agent that resends a large system prompt on every turn. On Anthropic or DeepSeek, the repeated portion is served from cache at a fraction of the input rate after the first call. On Groq, every token of that prompt is billed at the full input rate every single time. A provider with a higher headline input rate and working caching can come out cheaper on that shape of traffic.
This is the kind of thing that is invisible on a rate card and obvious in your
own data. Tag the workload with a dimension, run it
through both providers, and compare the actual total_cost_usd per request
rather than the advertised per-million rate. AI SpendOps records
cache_read_tokens for the providers that support caching and leaves it null
for Groq, so the difference shows up directly in the usage events.
What AI SpendOps records
| Field | Populated |
|---|---|
cache_read_tokens | No. Groq does not offer prompt caching |
cache_write_tokens | No |
reasoning_tokens | Yes for reasoning models that return completion_tokens_details |
provider_cost | No. Cost is calculated from token counts and the current Groq rate card |
Notes
- Groq's model catalogue changes relatively often as open-weight models are added and retired. If you call a model AI SpendOps does not yet have a rate for, the event is still recorded and the model is flagged for pricing rather than dropped.
- Use model allow-lists if you want a key restricted to specific Groq models, which also protects you from spend moving to an unexpected model after a deprecation.
- The proxy injects
stream_options: { include_usage: true }on streaming requests. See Streaming.