diff --git a/public/test-api.html b/public/test-api.html new file mode 100644 index 0000000..4188be1 --- /dev/null +++ b/public/test-api.html @@ -0,0 +1,363 @@ + + + + + + Edge Proxy — API Test + + + +
+

Edge Proxy Relay — API Test

+

Test all proxy endpoints from the browser

+ + +
+
+ AUTH API Key + +
+
+ +
+ + +
+
+
+ + +
+
+ GET /health + +
+
+ + +
+
+ + +
+
+ GET /v1/models + +
+
+ + +
+
+ + +
+
+ POST /v1/chat/completions + +
+
+ + + + + +
+ +
+
+ + +
+
+ POST /v1/messages (Anthropic) + +
+
+ + + + + + + +
+ +
+
+ + +
+
+ RELAY Generic HTTP Relay + +
+
+ + + + + + + + +
+ +
+
+ +
+
+ + + + diff --git a/src/index.ts b/src/index.ts index f78191a..ad2fe94 100644 --- a/src/index.ts +++ b/src/index.ts @@ -461,6 +461,14 @@ const server: Server = Bun.serve({ // Static routes if (url.pathname === "/health") return handleHealth(); if (url.pathname === "/docs") return handleDocs(); + if (url.pathname === "/test") { + const file = Bun.file("public/test-api.html"); + const exists = await file.exists(); + return new Response(exists ? file : "Not found", { + status: exists ? 200 : 404, + headers: { "Content-Type": "text/html; charset=utf-8" }, + }); + } if (url.pathname === "/" && req.method === "GET" && !req.headers.get("x-relay-target")) return handleIndex();