小冷 (@ghostcp)分享一个最简单的 dify 转 openai 接口的脚本 中发帖

使用方法: 
把下面的脚本保存到文件,替换 ‘https://xxx.xxx.com/base-api/v1’ 为你的 dify 的域名,然后使用 node 执行。
运行后,在各种客户端中的使用方法:
API Provider: OpenAI Compatible
Base URL: http://localhost:11434/v1
API Key: app-xxxxxxxxxxxx(你的 dify 的 api 接口)
Model ID: hello(任意填写)
优势:

新对话能开新的 dify conversationId;
同一用户的对话能复用 dify conversationId,也就是能有上下文。局限性是只能保持一个 conversationId;

// 创建 HTTP 服务器
import http from 'http';
import { URL } f...