# Amharic Toolkit API
A sellable backend API offering three things for Amharic/Ethiopian documents:
- **OCR** — extract text from images (Amharic, English, or both)
- **Translation** — Amharic ↔ English, via Meta's open-source NLLB-200 model
- **Structured extraction** — pull named fields (name, ID number, DOB, etc.) out of
known Ethiopian form/ID layouts
Everything runs on free/open-source engines — no per-call API costs to a third
party, so your margin is just your hosting bill.
## How customers use it
1. `POST /v1/signup` with an email → get back an API key (shown once, save it)
2. Send the key as `Authorization: Bearer ` on every other request
3. Free tier: 50 requests/day by default (`DEFAULT_DAILY_QUOTA_FREE`, and per-account
via `db.set_plan()` for anyone you want to give a paid/higher quota)
**Or try it instantly with no signup** — every endpoint also accepts the public
sandbox key `amh_sandbox_demo`, rate-limited to 5 requests/hour per IP and images
under 1MB. Good for letting prospects try before they commit to signing up.
Full interactive API docs are auto-generated at `/docs` once it's running (FastAPI's
Swagger UI) — genuinely useful for showing prospective customers exactly what they're
buying without writing separate documentation.
## Endpoints
| Endpoint | What it does |
|---|---|
| `POST /v1/signup` | Create an account, get an API key |
| `POST /v1/regenerate-key` | Invalidate your current key, get a new one (real accounts only) |
| `GET /v1/usage` | Check your quota/usage (works even if you're over quota) |
| `POST /v1/ocr` | Upload an image, get text + `avg_confidence` + `low_confidence` flag (`lang`: `amh`, `eng`, or `amh+eng`) |
| `POST /v1/translate` | `{text, target_lang, source_lang?}` → translated text (`am`/`en`; source auto-detected if omitted) |
| `POST /v1/extract` | Upload an image + `form_type` → structured JSON fields, plus the same confidence info |
| `GET /v1/templates` | List available `form_type` values for `/extract` | …