Transcribe through OpenRouter when OPENROUTER_API_KEY is set
A Claude subscription can't be used by the app, so let it use any cheap
vision model on OpenRouter instead (default google/gemini-3.1-flash-lite,
OPENROUTER_MODEL to change). The Anthropic API stays available as the
second choice. Both providers share the prompt and live behind one
{ name, model, transcribe } interface in server/providers.mjs; OpenRouter
retries 408/429/5xx and network errors and turns 401/402/404 into
messages the editor can show.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gVRDXpoukzgMFumoJt
This commit is contained in:
parent
46aa1236ed
commit
f353c14619
11 changed files with 258 additions and 91 deletions
|
|
@ -15,7 +15,7 @@ A link like `read.html?hra=hra-1931&postava=Lída` opens a play with the charact
|
|||
**Adding plays** (anyone with the upload password):
|
||||
|
||||
1. *Přidat hru*: give the title and pick a photo of each page.
|
||||
2. Each photo is read by a Claude vision model (Claude Haiku 5.5 by default) and turned into the script markup: speakers, stage directions, page numbers. Missing pages are noticed from gaps in the page numbers.
|
||||
2. Each photo is read by a vision model, through OpenRouter (default `google/gemini-3.1-flash-lite`) or the Anthropic API (`claude-haiku-5-5`), and turned into the script markup: speakers, stage directions, page numbers. Missing pages are noticed from gaps in the page numbers.
|
||||
3. The editor shows the text next to the photos and lists things to check (uncertain words marked `[?]`, characters who speak only once, pages that failed). Fix, tick *Zveřejněno*, save.
|
||||
|
||||
## Deploying
|
||||
|
|
@ -29,9 +29,12 @@ The app listens on port 3010 on loopback (`PORT` and `BIND_ADDRESS` change that)
|
|||
|
||||
| Variable | |
|
||||
|---|---|
|
||||
| `ANTHROPIC_API_KEY` | API key from [platform.claude.com](https://platform.claude.com). **A Claude Pro/Max subscription can't be used for this.** The API is billed separately, pay as you go. Without a key the app still works, but uploaded pages have to be typed up by hand. |
|
||||
| `OPENROUTER_API_KEY` | Key from [openrouter.ai](https://openrouter.ai/settings/keys) (prepaid credit). Used for transcription when set. |
|
||||
| `OPENROUTER_MODEL` | Any OpenRouter model that accepts images. Default `google/gemini-3.1-flash-lite` (about $0.0015 a page). `google/gemini-2.5-flash-lite` is cheaper. `anthropic/claude-haiku-5.5` and `google/gemini-3.5-flash` are alternatives if pages come out badly. |
|
||||
| `ANTHROPIC_API_KEY` | Instead of OpenRouter: an API key from [platform.claude.com](https://platform.claude.com). **A Claude Pro/Max subscription can't be used for this.** The API is billed separately. |
|
||||
| | Without either key the app still works, but uploaded pages have to be typed up by hand. |
|
||||
| `UPLOAD_PASSWORD` | Shared password for adding, editing and deleting plays. Unset = uploading switched off. |
|
||||
| `CLAUDE_MODEL` | `claude-haiku-5-5` (default, around $0.001 a page) or `claude-sonnet-5-5` (reads hard pages better, roughly 20× the price). |
|
||||
| `CLAUDE_MODEL` | With the Anthropic key: `claude-haiku-5-5` (default, around $0.001 a page) or `claude-sonnet-5-5` (reads hard pages better, roughly 20× the price). |
|
||||
| `DAILY_PAGE_LIMIT` | Cap on pages transcribed per day, for all users together (default 300), so a leaked password can't run up a bill. |
|
||||
| `MAX_PAGES` | Maximum photos per play (default 80). |
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue