Needed once, for the "Extract from Photo", "Bulk Extraction", and "Bulk Phonetic Conversion" tools inside Vocab Memorizer.
Go to console.anthropic.com, sign up (or sign in), add a small amount of billing credit, then go to API Keys → Create Key. Copy the key — it starts with sk-ant-....
Go to dash.cloudflare.com, sign up (free), then Workers & Pages → Create → Create Worker. Give it any name and deploy the default template — you'll replace the code next.
Open your new Worker → Edit code, delete everything there, and paste this in its place. Click Deploy.
export default {
async fetch(request, env) {
const cors = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'POST, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, X-Worker-Secret',
};
if (request.method === 'OPTIONS') return new Response(null, { headers: cors });
if (request.method !== 'POST') return new Response('Method not allowed', { status: 405, headers: cors });
const secret = request.headers.get('X-Worker-Secret');
if (!secret || secret !== env.WORKER_SECRET) {
return new Response(JSON.stringify({ error: 'Unauthorized' }), {
status: 401, headers: { ...cors, 'Content-Type': 'application/json' },
});
}
try {
const body = await request.text();
const apiResponse = await fetch('https://api.anthropic.com/v1/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': env.ANTHROPIC_API_KEY,
'anthropic-version': '2023-06-01',
},
body,
});
const responseText = await apiResponse.text();
return new Response(responseText, {
status: apiResponse.status,
headers: { ...cors, 'Content-Type': 'application/json' },
});
} catch (err) {
return new Response(JSON.stringify({ error: err.message }), {
status: 500, headers: { ...cors, 'Content-Type': 'application/json' },
});
}
},
};
In your Worker, go to Settings → Variables and Secrets → Add, and add two secret values:
• ANTHROPIC_API_KEY = the key you copied in Step 1
• WORKER_SECRET = the exact value below (copy it exactly — this must match what the site sends):
After deploying, your Worker's URL is shown at the top of its dashboard page — it looks like https://your-worker-name.your-subdomain.workers.dev. Copy it.
In Vocab Memorizer → Settings tab → AI Image Extraction → paste it into the Worker URL box → Save Worker URL.