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

Raised by CompletionApi.post (HTTP 400, error_code 'provider_quota_exceeded') when core.errors.error.QuotaExceededError is thrown. The Dify-hosted model provider quota (free trial allowance) for the tenant has been exhausted. The controller maps this to a client-facing error directing the user to set up their own provider credentials.

Source

Thrown at api/controllers/console/explore/completion.py:136

                user=current_user,
                args=args,
                invoke_from=InvokeFrom.EXPLORE,
                streaming=streaming,
            )

            # response-contract:ignore compact_generate_response
            return helper.compact_generate_response(response)
        except services.errors.conversation.ConversationNotExistsError:
            raise NotFound("Conversation Not Exists.")
        except services.errors.conversation.ConversationCompletedError:
            raise ConversationCompletedError()
        except services.errors.app_model_config.AppModelConfigBrokenError:
            logger.exception("App model config broken.")
            raise AppUnavailableError()
        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>/completion-messages/<string:task_id>/stop",
    endpoint="installed_app_stop_completion",
)
class CompletionStopApi(InstalledAppResource):
    @console_ns.response(200, "Success", console_ns.models[SimpleResultResponse.__name__])
    @with_current_user_id

View on GitHub (pinned to ef8544b173)

Solutions

  1. Configure your own provider credentials in Settings -> Model Provider to stop using the hosted pool.
  2. Update the app to use a model backed by your own credentials.
  3. Request a quota increase or upgrade the Dify plan if dependent on hosted providers.
  4. Audit which apps/users consume the most hosted quota and throttle them.

Example fix

# before: app pinned to Dify-hosted OpenAI; quota exhausted
# (completion-messages returns provider_quota_exceeded)

# after: switch the app model to your own provider
# Studio -> App -> Model -> select your OpenAI key -> Save & Publish
# then retry
Defensive patterns

Strategy: try-catch

Validate before calling

// If a quota endpoint exists, check remaining hosted quota before posting; otherwise,
// gate usage on a client-side budget counter and stop when near the limit.
if (hostedQuotaRemaining <= 0) { promptConfigureOwnProvider(); }

Type guard

function hasHostedQuota(quotaInfo) {
  return Number(quotaInfo?.remaining ?? 0) > 0;
}

Try / catch

try {
  await postCompletion(id, payload);
} catch (err) {
  if (err.code === 'provider_quota_exceeded') {
    // stop retrying hosted provider; prompt for BYO credentials
    promptConfigureOwnProvider();
  } else { throw err; }
}

Prevention

When it happens

Trigger: POST /console/installed-apps/<id>/completion-messages where the app uses a Dify-hosted provider whose token/call quota is used up. The hosted provider rejects the call and QuotaExceededError propagates up.

Common situations: Free-tier tenant exceeded the hosted OpenAI trial allowance; many users on one tenant drained the shared quota; long-running testing/eval burned through trial tokens; no BYO credentials configured so all traffic hits the hosted pool.

Related errors


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