test page
// Cloudflare Worker example
export default {
async fetch(request) {
if (request.method !== “POST”) return new Response(“Not allowed”, { status: 405 });
const body = await request.json();
const res = await fetch(“https://api.anthropic.com/v1/messages”, {
method: “POST”,
headers: {
“Content-Type”: “application/json”,
“x-api-key”: YOUR_ANTHROPIC_KEY, // stored as a Worker secret
“anthropic-version”: “2023-06-01”
},
body: JSON.stringify(body)
});
return new Response(await res.text(), {
headers: { “Content-Type”: “application/json”, “Access-Control-Allow-Origin”: “*” }
});
}
};