← Home
シェィンの英音法 — Eionpo

Set Up Your Own AI Image Extraction

Needed once, for the "Extract from Photo", "Bulk Extraction", and "Bulk Phonetic Conversion" tools inside Vocab Memorizer.

⚠️ These AI tools call Anthropic's Claude API, which costs real money per use. The site owner's account only covers the site owner's own usage — every teacher needs their own free Anthropic + Cloudflare account so nobody else's AI usage is billed to someone else.
1

Get your own Claude API key

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-....

Cost: extracting one word/image is a tiny fraction of a cent. A few dollars of credit covers a very large amount of use.
2

Create a free Cloudflare Worker

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.

3

Paste in this code

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' },
      });
    }
  },
};
4

Add two secrets

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):

4f8a2c6e-9d1b-47f3-b5e0-3c7a8912d6f4
Why this value specifically: Vocab Memorizer always sends this exact token with every request, no matter whose Worker it's calling — so your Worker must expect the same value to accept the request.
5

Copy your Worker's URL into Vocab Memorizer

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 MemorizerSettings tab → AI Image Extraction → paste it into the Worker URL box → Save Worker URL.

Done: extraction now runs on your own account. Nobody else can see or use your Worker URL or your API key — they're only saved in your own browser.