import { definePlugin, runWorker } from "@paperclipai/plugin-sdk"; import { FETCH_MODELS_ACTION } from "./constants.js"; import { fetchOpenAiModelCatalog } from "./lib/providers.js"; const plugin = definePlugin({ async setup(ctx) { ctx.actions.register(FETCH_MODELS_ACTION, async (params) => { const baseUrl = String(params.baseUrl ?? ""); const apiKey = String(params.apiKey ?? ""); return fetchOpenAiModelCatalog(ctx.http.fetch, { baseUrl, apiKey }); }); }, async onHealth() { return { status: "ok", message: "Global OpenAI Provider worker is running" }; }, }); export default plugin; runWorker(plugin, import.meta.url);