@2anki/cli
v0.1.6
Published
Turn your notes into Anki decks with the 2anki API
Downloads
642
Readme
2anki CLI
Turn your notes into Anki decks, using a 2anki API key.
Under development · invite-only. Access is limited to lifetime accounts and people who have been granted developer access. Request access from the Developers page.
Install (npm)
npx @2anki/cli login # run without installing
npm i -g @2anki/cli && 2anki login # or install globallyNode users get zero macOS Gatekeeper prompts this way.
Install (binary)
Download the binary for your platform from the latest release.
macOS — the binary is not yet notarized, so Gatekeeper blocks it on first run. Clear the quarantine flag once:
xattr -d com.apple.quarantine ./2anki-macos-arm64
chmod +x ./2anki-macos-arm64
./2anki-macos-arm64 helpLinux:
chmod +x ./2anki-linux-x64
./2anki-linux-x64 helpRename to 2anki and put it on your PATH to run it as 2anki <command>.
Install (dev)
From the repo root:
pnpm cli -- <command> # runs src/cli/index.ts via tsxLog in
2anki loginOpens the Developers page, where you create an
API key (shown once). Paste it back into the prompt. The key is stored in
~/.2anki/config.json with owner-only permissions. To skip the browser:
2anki login --key sk_live_…Access to the Developers page is limited to lifetime accounts. Free and subscriber accounts can request access from that page.
Commands
| Command | What it does |
| ---------------------- | ------------------------------------------------------ |
| 2anki login | Connect an API key |
| 2anki whoami | Show the account and keys this machine is connected to |
| 2anki convert <file> | Convert a file into an Anki deck |
| 2anki logout | Remove the stored key from this machine |
| 2anki help | Show help |
Configuration
| Env var | Purpose |
| -------------------- | ----------------------------------------------------------------------- |
| TWOANKI_API_BASE | Point the CLI at a different API host (defaults to https://2anki.net) |
| TWOANKI_CONFIG_DIR | Override where the key is stored (defaults to ~/.2anki) |
| NO_COLOR | Disable colored output |
Notes
- The CLI authenticates with the same quota and plan as your account — an API key acts as you.
convertuploads the file and waits for conversion. Headless.apkgdownload lands with the deck-download route once it accepts key auth; today the CLI points you at the web downloads page.
