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
ProviderQuotaExceededError (HTTP 400, code provider_quota_exceeded) raised in DatasetDocumentListApi.post when the underlying save/indexing call throws QuotaExceededError — the Dify-hosted (trial) model provider's usage quota has been exhausted. The default message instructs the user to supply their own provider credentials.
Source
Thrown at api/controllers/console/datasets/datasets_document.py:571
knowledge_config = KnowledgeConfig.model_validate(console_ns.payload or {})
if not dataset.indexing_technique and not knowledge_config.indexing_technique:
raise ValueError("indexing_technique is required.")
# validate args
DocumentService.document_create_args_validate(knowledge_config)
try:
documents, batch = DocumentService.save_document_with_dataset_id(
dataset, knowledge_config, current_user, session=session
)
dataset = DatasetService.get_dataset(dataset_id_str, session)
except ProviderTokenNotInitError as ex:
raise ProviderNotInitializeError(ex.description)
except QuotaExceededError:
raise ProviderQuotaExceededError()
except ModelCurrentlyNotSupportError:
raise ProviderModelCurrentlyNotSupportError()
return dump_response(
DatasetAndDocumentResponse,
{"dataset": dataset, "documents": document_responses(documents, session=session), "batch": batch},
)
@setup_required
@login_required
@account_initialization_required
@console_ns.response(204, "Documents deleted successfully")
@with_current_user
@with_current_tenant_id
@rbac_permission_required(RBACResourceScope.DATASET, RBACPermission.DATASET_EDIT)
@with_session
def delete(
self,View on GitHub (pinned to ef8544b173)
Solutions
- Add your own provider credentials in Settings -> Model Provider (OpenAI/Anthropic/etc.) and switch the dataset's embedding model to use them.
- Reduce the indexing load (smaller documents, fewer segments) to stay within the hosted quota if you must use it.
- Contact Dify sales/support to increase the hosted quota if applicable.
Example fix
// before — hosted trial quota exhausted POST /console/api/datasets/<id>/documents → 400 provider_quota_exceeded // after — use own provider // Settings → Model Provider → add own OpenAI key, select as embedding model provider POST /console/api/datasets/<id>/documents → 200
Defensive patterns
Strategy: try-catch
Validate before calling
# No code-side quota check is authoritative — the provider enforces it.
# Best pre-check: track local usage against a budget below the hosted cap.
def likely_within_quota(estimated_tokens: int, used: int, cap: int) -> bool:
return used + estimated_tokens < cap
if not likely_within_quota(est_tokens, tenant_used, hosted_cap):
return error("Switch to your own provider credentials to avoid quota exhaustion.") Type guard
def has_own_provider_credentials(tenant_id: str) -> bool:
"""True when the tenant is NOT solely dependent on the hosted trial."""
# pseudocode: inspect provider rows for a non-hosted, valid-credential provider
return any(not p.is_hosted_trial and p.has_credentials for p in list_providers(tenant_id)) Try / catch
from core.errors.error import QuotaExceededError
from controllers.console.app.error import ProviderQuotaExceededError
try:
documents, batch = DocumentService.save_document_with_dataset_id(...)
except QuotaExceededError:
raise ProviderQuotaExceededError() Prevention
- Move production tenants off the Dify-hosted trial onto their own provider credentials before quota matters.
- Show remaining hosted quota in the UI so users see exhaustion coming.
- Split very large batches into smaller chunks to reduce the blast radius of a mid-index quota failure.
When it happens
Trigger: POST /console/api/datasets/<dataset_id>/documents (typically high_quality indexing) using the Dify-hosted trial OpenAI provider after the tenant's free token quota ran out. The embedding/LLM call during indexing is rejected upstream as over-quota and re-raised here.
Common situations: Cloud/SaaS trial tenant relying on Dify's hosted OpenAI hit the free-tier cap; a large document batch consumed the remaining quota mid-index; long-time tenant that never switched to its own API key.
Related errors
- provider_quota_exceeded
- provider_not_initialize
- provider_not_initialize
- model_currently_not_support
- provider_quota_exceeded
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/02a074d49e101ae2.
Report an issue: GitHub.