MCPcopy Index your code
hub / github.com/12kv/dify-openai-apis

github.com/12kv/dify-openai-apis @v0.1.8

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.8 ↗ · + Follow
29 symbols 40 edges 4 files 7 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

Core symbols most depended-on inside this repo

parse_as_u64
called by 6
src/server/v1_handlers.rs
into_response
called by 2
src/server/helper.rs
init_server
called by 1
src/main.rs
show_welcome
called by 1
src/main.rs
app_routes
called by 1
src/server/mod.rs
get_bearer_token
called by 1
src/server/v1_handlers.rs
set_bearer_auth
called by 1
src/server/v1_handlers.rs
chat_completions
called by 1
src/server/v1_handlers.rs

Shape

Function 12
Class 11
Enum 4
Method 2

Languages

Rust100%

Modules by API surface

src/server/v1_handlers.rs20 symbols
src/server/helper.rs4 symbols
src/main.rs3 symbols
src/server/mod.rs2 symbols

For agents

$ claude mcp add dify-openai-apis \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page