Skip to main content
๐Ÿฅฆ

๐Ÿ”‘

Getting Your API Keys

A step-by-step guide to the three data services The Receipts uses. All of them are free.

What is an API key? It's like a password that lets The Receipts talk to an outside service on your behalf. Each service issues you your own key when you sign up.

The Receipts uses up to three services: USDA FoodData Central for nutrition data, Open Food Facts for product lookups (no key needed!), and Google Gemini for reading your receipt photos.

๐Ÿ”’ Prefer to keep everything on your own machine? You don't need a key to read receipt photos. The Receipts can run a local vision model instead, so your receipts never leave your computer โ€” and it's free.

Set OCR_BACKEND in your .env to one of:

  • local โ€” the default. A vision model such as LLaVA or Qwen2.5-VL via Ollama or LM Studio. Point OCR_BACKEND_URL at it.
  • gemini โ€” Google's hosted model. Fastest and most accurate; needs the key below.
  • openrouter โ€” your own OpenRouter account.

Digital PDF invoices (Whole Foods, Amazon Fresh) are parsed directly and need no vision model at all, whichever backend you pick.

โœจ

Google Gemini

The AI that reads your receipt photos and helps categorize items.

  1. You'll need a regular (free) Google account โ€” the same kind used for Gmail.
  2. Go to Google AI Studio and sign in.
  3. Click Get API key (top left), then Create API key.
  4. A key beginning with AIzaโ€ฆ is generated. Click the copy icon and save it somewhere safe.

๐Ÿ’ก Gemini has a free tier that is plenty for scanning household receipts.

โš ๏ธ Treat this key like a password โ€” anyone who has it can use AI services billed to your Google account if you later enable paid usage.

๐Ÿ”ฌ

USDA FoodData Central

Powers nutrition facts (calories, protein, sodiumโ€ฆ) for your grocery items.

  1. Open the signup page: fdc.nal.usda.gov/api-key-signup
  2. Enter your first name, last name, and email address. That's all โ€” no credit card, no account password.
  3. Click Signup. Your key appears on screen and is also emailed to you. It looks like a long string of random letters and numbers.
  4. Copy the key and save it somewhere safe (you'll paste it into your .env file โ€” see below).
๐Ÿ’ก The free key allows 1,000 requests per hour โ€” far more than The Receipts will ever need for a household.
๐Ÿฅซ

Open Food Facts

A free, community-run product database used for barcode and product lookups.

โœ… Good news โ€” no API key needed. Open Food Facts is an open database, free for everyone to read. The Receipts simply identifies itself politely when it asks for data, and that's it. There is nothing for you to sign up for or configure.

If you'd ever like to contribute product data back to the community (photos, corrections), you can create a free account at world.openfoodfacts.org โ€” but The Receipts doesn't require it.

๐Ÿ“„

Where do the keys go?

Both keys live in a plain-text file called .env in the project's root folder.

Open (or create) the .env file next to grocery.db and add one line per key:

FDC_API_KEY=paste-your-usda-key-here
GEMINI_API_KEY=paste-your-gemini-key-here
  • No quotes, no spaces around the = sign.
  • Restart the app after editing the file โ€” keys are read at startup.
  • Never share this file or commit it to version control. It's your keys' home, and it should stay private.
โš™๏ธ

Back to Settings

Return to exclusions, rules, and data management.

โ†
๐Ÿ“ธ Static demo โ€” fictional data, read-only