Inference APIs

Groq 498 capacity_exceeded: "Flex Tier Capacity Exceeded"

Your request to Groq with service_tier: "flex" came back with status 498 and "code": "capacity_exceeded". Groq made up this status for its flex tier. Flex gives paid accounts about ten times the normal rate limits at the on-demand price, but only while spare capacity lasts. When the pool is full, Groq rejects the request immediately instead of queueing it. Nothing is wrong with your key, your request or your limits, and nothing was charged. Something in your stack has to decide what happens to that request next.

Last verified December 1, 2026 against Groq API errors (498), Groq flex processing, Groq service tiers, laravel/ai: fail over on Groq 498 · 5 min read

ProviderGroq
HTTP status498 (Groq's own code; not a standard HTTP status)
Error codecapacity_exceeded
Who sees itPaid Groq plans that send service_tier: "flex". Flex is for paid customers only
What it meansThe shared flex pool is full; the request was not processed
Charged?No. The request never ran
Can you wait it out?Yes, usually seconds to minutes. Groq says to add jittered backoff and retries
Short answer
  • 498 is not 429. A 429 means you used up your limit. A 498 means Groq's shared flex pool is full for everyone. Handle them separately.
  • Your SDK will not retry it. The groq and openai SDKs retry 408, 409, 429 and 5xx. A 498 is raised straight to your code as APIStatusError.
  • Cheapest fix: retry with jittered backoff, then resend on on_demand, where your normal paid limits apply.
  • If neither is acceptable (real-time apps, agents mid-task), send the same request with the same model id to a second provider.
Try it now: no account, no key

Send a prompt to openai/gpt-oss-120b (the same id you use on Groq) on a pay-per-request endpoint with no tier to unlock and see it answer here. Five free requests per day.

What the 498 means

Groq has four service tiers, chosen by the service_tier field of a chat completion: on_demand (the default), flex, auto and performance (enterprise). Flex is best effort. Groq's docs say that if flex capacity is unavailable, "requests will fail quickly with status 498 and error capacity_exceeded". The body uses Groq's usual error envelope, so check error.code, not the message text:

Response body (shape)
{
  "error": {
    "message": "...",
    "type": "...",
    "code": "capacity_exceeded"
  }
}
StatusWhose problemWhat to do
498 capacity_exceededGroq's flex pool is fullBack off and retry, use on_demand, or fail over
429 rate_limit_exceededYour own RPM/TPM/RPD/TPD limitWait for the window named in the error; see Groq 429
503Groq overloaded or in maintenance (any tier)Retry later or fail over
500 / 502Server error, not chargedRetry once

Fix 1: retry with jitter (batch and background jobs)

For work that can wait, such as nightly classification, embeddings preprocessing or evals, retrying is the cheapest fix. Flex is priced the same as on-demand, so the only cost is time. Add random jitter so that many workers do not all retry at the same moment and hit the full pool again:

Python · tell 498 apart from 429 and retry with jitter
import random, time
from groq import Groq, APIStatusError

client = Groq()

def flex_chat(messages, model="openai/gpt-oss-120b", attempts=4):
    for i in range(attempts):
        try:
            return client.chat.completions.create(
                model=model, messages=messages, service_tier="flex", max_tokens=800)
        except APIStatusError as e:
            if e.status_code != 498:          # 429 = your rate limit, 4xx = your request: handle elsewhere
                raise
            # Flex pool is full. The SDK does not retry 498 by itself (it retries 408/409/429/5xx).
            time.sleep(min(8, 0.5 * 2 ** i) * random.uniform(0.5, 1.5))
    raise RuntimeError("Groq flex capacity unavailable after retries")
Wrappers vary. LangChain and CrewAI generally surface it as a raw status error. Recent laravel/ai and pydantic-ai releases treat 498 as "overloaded / unavailable" and fail over if you configured a fallback model. LiteLLM users can map it to a fallback in the router config.

Fix 2: fall back to on_demand, then to a second provider

For anything a user is waiting on, a retry loop adds seconds of dead time. Resend on on_demand, where your normal paid limits apply. If that is also limited, or Groq returns 503, send the same request to another OpenAI-compatible endpoint. The model ids below are the same on both sides, so the answer comes from the same open-weight model:

Python · flex first, then on_demand, then a second provider with the same model id
import os
from openai import OpenAI, APIStatusError

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

def chat(messages, model="openai/gpt-oss-120b"):
    for tier in ("flex", "on_demand"):
        try:
            return groq.chat.completions.create(model=model, messages=messages,
                                                service_tier=tier, max_tokens=800)
        except APIStatusError as e:
            if e.status_code == 498:        # flex full: try the normal tier
                continue
            if e.status_code in (429, 503): # on_demand limit or Groq overloaded: leave Groq
                break
            raise
    # Same request, same model id. service_tier is accepted and ignored here, so nothing else changes.
    return backup.chat.completions.create(model=model, messages=messages, max_tokens=800)
TypeScript · the same chain with the openai package
import OpenAI from "openai";

const groq = new OpenAI({ baseURL: "https://api.groq.com/openai/v1", apiKey: process.env.GROQ_API_KEY });
const backup = new OpenAI({ baseURL: "https://api.inferenceapis.com/openai/v1", apiKey: process.env.INFERENCE_API_KEY });

export async function chat(messages: OpenAI.ChatCompletionMessageParam[], model = "openai/gpt-oss-120b") {
  try {
    // @ts-expect-error service_tier "flex" is Groq-specific
    return await groq.chat.completions.create({ model, messages, service_tier: "flex", max_tokens: 800 });
  } catch (e) {
    if (!(e instanceof OpenAI.APIError) || ![498, 429, 503].includes(e.status ?? 0)) throw e;
    return backup.chat.completions.create({ model, messages, max_tokens: 800 });
  }
}

Only the base URL and key change. service_tier can stay in the body: we accept it and ignore it, and our own hosts choose the capacity. If you use Groq for transcription, whisper-large-v3 and whisper-large-v3-turbo fall back the same way; see the speech-to-text API.

Should you just use service_tier "auto"?

Groq's auto tier picks "the best tier available to you at any given moment", so it is the simple option if you only want Groq. It does not raise your ceiling, though. When flex is full you are back on on-demand limits, and a burst large enough to need flex will then return 429 instead of 498. A second provider is useful because its capacity does not depend on Groq's.

Frequently asked questions

Am I billed for a request that returned 498?

No. Groq says the request "won't be processed", and its error docs say server-side failures are not charged. Retries that succeed are billed normally at the on-demand price.

I am on the free plan and got 498. How?

Flex is for paid customers only. On the free plan, Groq rejects service_tier: "flex" or ignores it. If you see 498, check that the key belongs to the paid organization. If upgrading is the problem, see Developer tier upgrades are unavailable and Error processing subscription upgrade.

Why does my HTTP client say "unknown status 498"?

498 is not a registered HTTP status. Groq uses it as a private code, like nginx uses 499. Some clients and proxies label it unknown or turn it into a generic error. Compare the numeric status and error.code, not the reason phrase.

Does flex make Groq cheaper?

No. Groq prices flex the same as on-demand. Flex buys higher rate limits, not a discount. The discounted path for jobs that can wait is Groq's Batch API, which does not accept service_tier.

Will a second provider give the same output?

For open-weight models such as openai/gpt-oss-120b, it is the same published model. Speed, price and limits differ by host, and outputs differ only by sampling. Side by side.

Where Inference APIs fits

The last fix above sends a request that Groq's flex pool turned away to a second OpenAI-compatible endpoint, with the same model id. Inference APIs serves openai/gpt-oss-120b ($0.20 / $0.80 per million tokens) and openai/gpt-oss-20b under Groq's ids at the Groq-style path /openai/v1. It accepts and ignores service_tier, so your request body does not change. It is pay-as-you-go from a $5 top-up, with no plan or tier.

Something changed or wrong? Tell us and we will re-verify the entry.