{"record":{"id":"fb0e45e858a011cb","repo":"FlowiseAI/Flowise","slug":"please-set-the-replicate-api-token","errorCode":null,"errorMessage":"Please set the REPLICATE_API_TOKEN","messagePattern":"Please set the REPLICATE_API_TOKEN","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/llms/Replicate/core.ts","lineNumber":34,"sourceCode":"\nexport class Replicate extends LLM implements ReplicateInput {\n    lc_serializable = true\n\n    model: ReplicateInput['model']\n\n    input: ReplicateInput['input']\n\n    apiKey: string\n\n    promptKey?: string\n\n    constructor(fields: ReplicateInput & BaseLLMParams) {\n        super(fields)\n\n        const apiKey = fields?.apiKey\n\n        if (!apiKey) {\n            throw new Error('Please set the REPLICATE_API_TOKEN')\n        }\n\n        this.apiKey = apiKey\n        this.model = fields.model\n        this.input = fields.input ?? {}\n        this.promptKey = fields.promptKey\n    }\n\n    _llmType() {\n        return 'replicate'\n    }\n\n    /** @ignore */\n    async _call(prompt: string, options: this['ParsedCallOptions']): Promise<string> {\n        const replicate = await this._prepareReplicate()\n        const input = await this._getReplicateInput(replicate, prompt)\n\n        const output = await this.caller.callWithOptions({ signal: options.signal }, () =>","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/llms/Replicate/core.ts#L16-L52","documentation":"Replicate constructor checks only fields.apiKey (no environment-variable fallback) and throws if falsy. Unlike HuggingFaceInference, REPLICATE_API_TOKEN is NOT read automatically here.","triggerScenarios":"Instantiating the Replicate LLM node without passing apiKey in fields, even if REPLICATE_API_TOKEN is set in the environment.","commonSituations":"Expecting the env var to be picked up automatically (it is not); credential not wired into the node; credential object empty.","solutions":["Attach a Replicate credential to the node so apiKey is passed into fields.","Explicitly read the env var and pass it: new Replicate({ apiKey: process.env.REPLICATE_API_TOKEN, ... }).","Verify the credential was saved with a non-empty token before re-running."],"exampleFix":"// before\nconst llm = new Replicate({ model: 'meta/llama-2-70b', input: {} })\n// after\nconst llm = new Replicate({ model: 'meta/llama-2-70b', input: {}, apiKey: process.env.REPLICATE_API_TOKEN })","handlingStrategy":"validation","validationCode":"// Replicate has NO env fallback - you must pass apiKey explicitly\nconst apiKey = fields.apiKey ?? process.env.REPLICATE_API_TOKEN\nif (!apiKey) throw new Error('REPLICATE_API_TOKEN is not set')\nconst llm = new Replicate({ ...fields, apiKey })","typeGuard":"function hasReplicateToken(fields: { apiKey?: string }): boolean {\n  return Boolean(fields.apiKey ?? process.env.REPLICATE_API_TOKEN)\n}","tryCatchPattern":"try {\n  const llm = new Replicate(fields)\n} catch (e) {\n  if (/REPLICATE_API_TOKEN/.test((e as Error).message)) {\n    // prompt for credential setup; do not retry\n  }\n  throw e\n}","preventionTips":["Do not assume REPLICATE_API_TOKEN is read automatically - pass apiKey explicitly.","Attach a Replicate credential component in Flowise.","Add a startup check that fails fast if no token is configured.","Store tokens in a secret manager, not the repo."],"tags":["replicate","llm","api-key","auth","configuration"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}