affaan-m/ECC · error · AuthenticationError

{msg}

Error message

{msg}

What it means

AtlasProvider.generate() wraps an OpenAI-compatible call to the Atlas reasoning-model gateway. Line 133 re-raises the caught exception as llm.core.interface.RateLimitError (tagged with the Atlas provider) when the exception's stringified message contains '429' or 'rate_limit'. The match is naive substring detection on str(e), so it only fires if the SDK surfaces the HTTP status or the literal token 'rate_limit' in its message text. Atlas reasoning models also reserve a thinking-token budget, which can push a request over TPM limits faster than the raw prompt suggests.

Source

Thrown at src/llm/providers/atlas.py:133

            usage = None
            if response.usage:
                usage = {
                    "prompt_tokens": response.usage.prompt_tokens,
                    "completion_tokens": response.usage.completion_tokens,
                    "total_tokens": response.usage.total_tokens,
                }

            return LLMOutput(
                content=choice.message.content or "",
                tool_calls=tool_calls,
                model=response.model,
                usage=usage,
                stop_reason=choice.finish_reason,
            )
        except Exception as e:
            msg = str(e)
            if "401" in msg or "authentication" in msg.lower():
                raise AuthenticationError(msg, provider=self.provider_type) from e
            if "429" in msg or "rate_limit" in msg.lower():
                raise RateLimitError(msg, provider=self.provider_type) from e
            if "context" in msg.lower() and "length" in msg.lower():
                raise ContextLengthError(msg, provider=self.provider_type) from e
            raise

    def list_models(self) -> list[ModelInfo]:
        return self._models.copy()

    def validate_config(self) -> bool:
        return bool(self.api_key)

    def get_default_model(self) -> str:
        return self.default_model

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Wrap generate() in exponential backoff keyed on llm.core.interface.RateLimitError and retry.
  2. Throttle concurrent generate() calls per Atlas API key with a semaphore.
  3. Verify the Atlas key tier/quota and request an increase if sustained throughput is needed.
  4. Reduce prompt size or fan-out so total tokens-per-minute stays under the limit.

Example fix

// before
output = provider.generate(llm_input)

// after
import time
from llm.core.interface import RateLimitError

for attempt in range(4):
    try:
        output = provider.generate(llm_input)
        break
    except RateLimitError:
        if attempt == 3:
            raise
        time.sleep(2 ** attempt)
Defensive patterns

Strategy: retry

Type guard

from llm.core.interface import RateLimitError

def is_rate_limit(exc: BaseException) -> bool:
    return isinstance(exc, RateLimitError)

Try / catch

import time
from llm.core.interface import RateLimitError

for attempt in range(4):
    try:
        output = provider.generate(llm_input)
        break
    except RateLimitError:
        if attempt == 3:
            raise
        time.sleep(2 ** attempt)

Prevention

When it happens

Trigger: Calling AtlasProvider.generate() when the Atlas endpoint responds HTTP 429 Too Many Requests; the openai SDK raising an error whose str() contains '429' or 'rate_limit' (e.g. openai.RateLimitError); exceeding the per-minute RPM or TPM quota on the Atlas gateway.

Common situations: Bursting past the Atlas gateway RPM/TPM quota; a shared org key used by multiple concurrent jobs; CI/load-test runs hammering the reasoning endpoint; thinking-token budget inflating billable TPM.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/d3a736a301ef405e. Report an issue: GitHub.