Giter Site home page Giter Site logo

dify-openai-apis's Introduction

English | δΈ­ζ–‡

dify-openai-apis

License

Description

OpenAI-compatible APIs for Dify platform services.
This crate provides a set of APIs that are compatible with OpenAI's GPT-3 API, and can be used to interact with Dify's platform services and tools.

Note: The app currently does not support OpenAI's Legacy Completions API. Please use the Chat Completion API instead.

Config

Configurations can be set via .env file or environment variables:

  • HOST: The host to bind the server to. Default: 127.0.0.1
  • PORT: The port to bind the server to. Default: 3000
  • DIFY_BASE_URL: The base URL of Dify's API. Default: https://api.dify.ai
  • DIFY_API_KEY: Your API key for Dify's API. Default: your_api_key
  • DIFY_TIMEOUT: The timeout for requests to Dify's API. Default: 10
  • WORKERS_NUM: The number of worker threads to use. Default: 4
  • RUST_LOG: The log level for the server. Default: error

Note:

  • DIFY_API_KEY is the default API key. If a user provides an API key via Bearer Token when requesting the API /v1/chat/completions, it will override this default value.
  • RUST_LOG is the log level, with a default value of error, meaning only error logs will be output. If you want to debug, it is recommended to set it to debug or trace.

Install

Please download the precompiled binary from : Release page

You can also install it using the cargo command.

# require cargo installed
cargo install dify-openai-apis

Usage

To start the server, run:

# require cargo bin directory in PATH
# export PATH=$HOME/.cargo/bin:$PATH
dify-openai-apis

dify-openai-apis's People

Contributors

rming avatar

Stargazers

Cui Jiahua avatar  avatar  avatar Tommy avatar Mgrsc avatar

Watchers

 avatar Tommy avatar

Forkers

reminmg2000

dify-openai-apis's Issues

A dockerfile and a Compose to launch it

Hi,

please find a way to launch it on docker :

FROM rust:latest
WORKDIR /usr/bin
RUN apk add musl-dev
RUN cargo install dify-openai-apis
CMD ["dify-openai-apis"]

to build the image:
docker build --pull --rm -f "dockerfile.dockerfile" -t difyopenaiapis:0.1.8 "."

and a compose.yaml to launch it:

  difyopenaiapis:
    image: "difyopenaiapis:0.1.8"
    container_name: difyopenaiapis
    environment:
      HOST: 0.0.0.0
      PORT: 3000
      DIFY_BASE_URL: "http://dify.api.to"
      DIFY_API_KEY: "app-******"
      DIFY_TIMEOUT: 20
      WORKERS_NUM: 4
      RUST_LOG: "debug"
    ports:
      - '8080:3000'
    restart: "always"

Regards

Error occurred when using this API in some applications.

I found that when I call this API interface on front-end pages like chatgpt-next-web, it works fine. But when I call the same interface in some applications, such as Qchatgpt and chatgpt on WeChat, it gives an error instead of returning the expected output. I'd like to know if the program hasn't fully implemented OpenAI's request format or if there's an issue with my configuration.
image

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.