Skip to content

yjl9903/CloseAI

Repository files navigation

CloseAI

OpenAI proxy cloudflare worker.

Features

  • Proxy OpenAI API endpoints
  • Support API key mask

Usage

Use https://closeai.onekuma.cn/ or your deployed worker domain.

Or use in openai module.

import { Configuration } from 'openai'

const configuration = new Configuration({
  apiKey: OPENAI_API_KEY,
  basePath: 'https://closeai.onekuma.cn/v1'
})

API key mask

Generate a new CloseAI API key to replace the usage of the original OpenAI API key, so that you can use the generated key instead of the original one to avoid the leak of your real API key.

$ curl -X POST -H "Content-Type: application/json" \
       -d '{"key": "sk-<your original api key>"}' \
       https://closeai.onekuma.cn/_/key
{"key":"sk-<your generated api key>"}

Deploy

pnpm install
pnpm run deploy

Inspiration

License

MIT License © 2023 XLor