import {
  getModels
} from "./chunk-6AIKJWPI.js";
import {
  jsonOk,
  routeWrap
} from "./chunk-ZMMFMEXX.js";

// src/handlers/models.ts
function handleListModels(request) {
  return routeWrap(request, async ({ request: req }) => {
    const url = new URL(req.url);
    const engine = url.searchParams.get("engine") ?? void 0;
    const provider = url.searchParams.get("provider") ?? void 0;
    const q = url.searchParams.get("q") ?? void 0;
    const models = await getModels({ engine, provider, q });
    return jsonOk({ data: models });
  });
}

export {
  handleListModels
};
