content/providers/03-community-providers/98-flowise.mdx
The Flowise provider allows you to easily integrate Flowise chatflows with your applications using the AI SDK.
The Flowise provider is available in the @ahmedrowaihi/flowise-vercel-ai-sdk-provider module. You can install it with:
<Tabs items={['pnpm', 'npm', 'yarn']}> <Tab> <Snippet text="pnpm add @ahmedrowaihi/flowise-vercel-ai-sdk-provider" dark /> </Tab> <Tab> <Snippet text="npm install @ahmedrowaihi/flowise-vercel-ai-sdk-provider" dark /> </Tab> <Tab> <Snippet text="yarn add @ahmedrowaihi/flowise-vercel-ai-sdk-provider" dark /> </Tab> </Tabs>
You can import the provider factory from @ahmedrowaihi/flowise-vercel-ai-sdk-provider:
import { createFlowiseProvider } from '@ahmedrowaihi/flowise-vercel-ai-sdk-provider';
Create a file called .env.local and add your Flowise configuration:
FLOWISE_BASE_URL=https://your-flowise-instance.com
FLOWISE_API_KEY=your_api_key_optional
import { createFlowiseProvider } from '@ahmedrowaihi/flowise-vercel-ai-sdk-provider';
import { generateText } from 'ai';
const flowise = createFlowiseProvider({
baseUrl: process.env.FLOWISE_BASE_URL!,
apiKey: process.env.FLOWISE_API_KEY,
});
const { text } = await generateText({
model: flowise('your-chatflow-id'),
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
import { createFlowiseModel } from '@ahmedrowaihi/flowise-vercel-ai-sdk-provider';
import { generateText } from 'ai';
const { text } = await generateText({
model: createFlowiseModel({
baseUrl: process.env.FLOWISE_BASE_URL!,
apiKey: process.env.FLOWISE_API_KEY,
chatflowId: 'your-chatflow-id',
}),
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
import { streamText } from 'ai';
import { createFlowiseProvider } from '@ahmedrowaihi/flowise-vercel-ai-sdk-provider';
const flowise = createFlowiseProvider({
baseUrl: process.env.FLOWISE_BASE_URL!,
apiKey: process.env.FLOWISE_API_KEY,
});
const result = streamText({
model: flowise('your-chatflow-id'),
prompt: 'Write a story about a robot learning to cook.',
});
return result.toDataStreamResponse();
For more information and advanced usage, see the Flowise provider documentation.