FlowiseAI/Flowise · error · Error

Perplexity API Key missing from credential

Error message

Perplexity API Key missing from credential

What it means

ChatPerplexity resolves its API key via getCredentialParam('perplexityApiKey', ...) from the bound credential. If that returns falsy, Flowise refuses to construct the model. Unlike HuggingFace there is no env-var fallback in this node — the key must come from the credential component.

Source

Thrown at packages/components/nodes/chatmodels/ChatPerplexity/ChatPerplexity.ts:198

        const presencePenalty = nodeData.inputs?.presencePenalty as string
        const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string
        const streaming = nodeData.inputs?.streaming as boolean
        const timeout = nodeData.inputs?.timeout as string
        const searchDomainFilterRaw = nodeData.inputs?.searchDomainFilter
        const returnImages = nodeData.inputs?.returnImages as boolean
        const returnRelatedQuestions = nodeData.inputs?.returnRelatedQuestions as boolean
        const searchRecencyFilter = nodeData.inputs?.searchRecencyFilter as string
        const proxyUrl = nodeData.inputs?.proxyUrl as string
        const cache = nodeData.inputs?.cache as BaseCache

        if (nodeData.inputs?.credentialId) {
            nodeData.credential = nodeData.inputs?.credentialId
        }
        const credentialData = await getCredentialData(nodeData.credential ?? '', options)
        const apiKey = getCredentialParam('perplexityApiKey', credentialData, nodeData)

        if (!apiKey) {
            throw new Error('Perplexity API Key missing from credential')
        }

        const obj: PerplexityChatInput = {
            model,
            apiKey,
            streaming: streaming ?? true
        }

        if (temperature) obj.temperature = parseFloat(temperature)
        if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
        if (topP) obj.topP = parseFloat(topP)
        if (topK) obj.topK = parseInt(topK, 10)
        if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty)
        if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty)
        if (timeout) obj.timeout = parseInt(timeout, 10)
        if (returnImages) obj.returnImages = returnImages
        if (returnRelatedQuestions) obj.returnRelatedQuestions = returnRelatedQuestions
        if (searchRecencyFilter && searchRecencyFilter !== '') obj.searchRecencyFilter = searchRecencyFilter

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Open the ChatPerplexity node and bind a Perplexity credential with perplexityApiKey filled.
  2. If using credentialId input wiring, ensure the id resolves to an existing Perplexity credential.
  3. Create a new credential of the correct type if none exists, then bind it.
  4. Re-import the credential alongside the chatflow when copying between workspaces.

Example fix

// before
nodeData.credential = '' // or wrong-type credential

// after
nodeData.credential = 'perplexity-cred-id'
// credential component: perplexityApiKey = 'pplx-xxx'
Defensive patterns

Strategy: validation

Validate before calling

const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const apiKey = getCredentialParam('perplexityApiKey', credentialData, nodeData)
if (!apiKey) {
  throw new Error('ChatPerplexity requires a Perplexity credential with perplexityApiKey filled.')
}

Type guard

function hasPerplexityKey(cred: unknown): cred is { perplexityApiKey: string } {
  return typeof (cred as any)?.perplexityApiKey === 'string' && (cred as any).perplexityApiKey.length > 0
}

Try / catch

try {
  return await initChatPerplexity(nodeData, options)
} catch (e) {
  if (e.message === 'Perplexity API Key missing from credential') {
    return { error: 'Bind a Perplexity credential (perplexityApiKey) to this node.' }
  }
  throw e
}

Prevention

When it happens

Trigger: nodeData.credential is unbound or points to a credential whose perplexityApiKey field is blank; the credentialId input is set but the credential name does not resolve; the user added the node without selecting a Perplexity credential.

Common situations: New Perplexity node added without binding a credential; wrong credential type selected (e.g. OpenAI cred bound to a Perplexity node); credential was renamed/deleted in the workspace; chatflow JSON imported without its credential payload.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/12a8b9886f622fe5. Report an issue: GitHub.