据很多网友反应,OpenAI 检测到**的 API 访问时,会直接封号。所以我在国外的服务器上搭建了一个代理,用于访问 OpenAI/ChatGPT 的 API。
Fork this repo
https://dash.deno.com/new Deploy like following
使用 OpenAI/ChatGPT 官方 npm 包:
import { Configuration } from "openai";
const configuration = new Configuration({
apiKey: OPENAI_API_KEY,
+ basePath: "https://<your deno instance>/v1",
});
使用 OpenAI/ChatGPT 官方 Python 包:
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
+ openai.api_base = "<your deno instance>/v1"
deno run --allow-net --allow-read --allow-env --watch deno.ts