Giter Site home page Giter Site logo

dify2openai's Introduction

DIFY2OPENAI

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.

Features

  • Convert Dify API into an OpenAI API
  • Support streaming and blocking
  • Support Agent bots API on dify
  • Support Chat bots API on dify

Deployment

Zeabur

Deploy on Zeabur

Vercel

Deploy with Vercel

Note: Vercel's serverless functions have a 10-second timeout limit.

Local Deployment

  1. Set the environment variable in the .env file
DIFY_API_URL=https://api.dify.ai/v1
  1. Install dependencies
npm install
  1. Run the project
npm start

Usage

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);

Roadmap

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

Contact

Feel free to reach out for any questions or feedback

X
telegram

Buy Me A Coffee

License

This project is licensed under the MIT License.

dify2openai's People

Contributors

0w0z avatar fatwang2 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.