Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

656 B
Raw Blame
import type { DeploymentEdition } from '@dify/contracts/api/console/system-features/types.gen'
import type { ModelProviderSummaryResponse } from '@dify/contracts/api/console/workspaces/types.gen'

type CreditAwareProvider = Pick<ModelProviderSummaryResponse, 'provider' | 'system_configuration'>

export const providerSupportsCredits = (
  provider: CreditAwareProvider | undefined,
  trialModels: readonly string[] | undefined,
  deploymentEdition: DeploymentEdition,
): boolean => {
  if (deploymentEdition !== 'CLOUD' || !provider?.system_configuration.enabled) return false

  return !!provider.provider && !!trialModels?.includes(provider.provider)
}