Use Dify on your favorite OpenAI client.
This project converts the Dify API to the OpenAI API format, giving you access to Dify's LLMs, knowledge base, tools, and workflows within your preferred OpenAI clients.
- Convert Dify API into an OpenAI API
- Support streaming and blocking
- Support Agent bots API on dify
- Support Chat bots API on dify
Note: Vercel's serverless functions have a 10-second timeout limit.
- Set the environment variable in the .env file
DIFY_API_URL=https://api.dify.ai/v1
- Install dependencies
npm install
- Run the project
npm start
const response = await fetch('http://localhost:3000/v1/chat/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_DFIY_API_KEY',
},
body: JSON.stringify({
model: 'dify',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello, how are you?' },
],
}),
});
const data = await response.json();
console.log(data);
Coming Soon
- Workflow Bot
- Variables support
- Image support
- Audio-to-text
- Text-to-audio
- Docker support
Available Now
- Continuous dialogue
- Zeabur & Vercel deployment
- Streaming & Blocking
- Agent & Chat bots
Feel free to reach out for any questions or feedback
This project is licensed under the MIT License.