langgenius/dify · error · ProviderQuotaExceededError

provider_quota_exceeded

provider_quota_exceeded

Error message

Your quota for Dify Hosted Model Provider has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials.

What it means

HTTP 400 with error_code provider_quota_exceeded, raised when generate_more_like_this raises QuotaExceededError. The Dify hosted model provider quota for the tenant has been exhausted.

Solutions

  1. Upgrade the plan or wait for the quota window to reset.
  2. Configure your own provider credentials under Settings -> Model Provider so generation bypasses the hosted quota.
  3. Reduce generation frequency (cache more-like-this results per message).
  4. Check usage in the billing dashboard to confirm the quota state.

Example fix

# before: relying solely on hosted provider quota
resp = get(more_like_this_url(id, mid))

# after: fall back to own credentials when hosted quota is exhausted
try:
    resp = get(more_like_this_url(id, mid))
except QuotaExceeded:
    switch_to_own_provider_credentials()
    resp = get(more_like_this_url(id, mid))
Defensive patterns

Strategy: fallback

Validate before calling

// Check hosted quota before generation if a usage endpoint is available
const usage = await get('/console/billing/usage');
if (usage.hosted_quota_remaining <= 0) {
  ensureOwnProviderConfigured(); // switch path before calling
}

Type guard

function hostedQuotaAvailable(usage) {
  return Number(usage?.hosted_quota_remaining) > 0;
}

Try / catch

try {
  return await get(moreLikeThisUrl(id, mid));
} catch (e) {
  if (e.code === 'provider_quota_exceeded') {
    await switchToOwnProviderCredentials();
    return get(moreLikeThisUrl(id, mid)); // fallback to own credentials
  }
  throw e;
}

Prevention

When it happens

Trigger: GET more-like-this when the tenant has used up its hosted-model quota. The service raises QuotaExceededError and the controller maps it to ProviderQuotaExceededError(400).

Common situations: Free/trial plan quota used up; high-volume usage on the hosted provider; billing downgrade reduced the quota; many users sharing the same tenant hitting the limit together.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/ff745e543328696a. Report an issue: GitHub.

Appendix: source

Thrown at api/controllers/console/explore/message.py:187

        try:
            response = AppGenerateService.generate_more_like_this(
                session=session,
                app_model=app_model,
                user=current_user,
                message_id=message_id_str,
                invoke_from=InvokeFrom.EXPLORE,
                streaming=streaming,
            )
            # response-contract:ignore compact_generate_response
            return helper.compact_generate_response(response)
        except MessageNotExistsError:
            raise NotFound("Message Not Exists.")
        except MoreLikeThisDisabledError:
            raise AppMoreLikeThisDisabledError()
        except ProviderTokenNotInitError as ex:
            raise ProviderNotInitializeError(ex.description)
        except QuotaExceededError:
            raise ProviderQuotaExceededError()
        except ModelCurrentlyNotSupportError:
            raise ProviderModelCurrentlyNotSupportError()
        except InvokeError as e:
            raise CompletionRequestError(e.description)
        except ValueError as e:
            raise e
        except Exception:
            logger.exception("internal server error.")
            raise InternalServerError()


@console_ns.route(
    "/installed-apps/<uuid:installed_app_id>/messages/<uuid:message_id>/suggested-questions",
    endpoint="installed_app_suggested_question",
)
class MessageSuggestedQuestionApi(InstalledAppResource):
    @console_ns.response(200, "Success", console_ns.models[SuggestedQuestionsResponse.__name__])
    @with_current_user

View on GitHub (pinned to ef8544b173)