You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56-11Lines changed: 56 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,32 +12,74 @@ The CLI connects to the [Bitrefill MCP server](https://api.bitrefill.com/mcp) an
12
12
npm install -g @bitrefill/cli
13
13
```
14
14
15
-
## Authentication
15
+
## Quick start (`init`)
16
16
17
-
### OAuth (default)
17
+
The fastest way to set up the CLI:
18
18
19
-
On first run, the CLI opens your browser for OAuth authorization. Credentials are stored in `~/.config/bitrefill-cli/`.
19
+
```bash
20
+
bitrefill init
21
+
```
20
22
21
-
### API Key
23
+
This walks you through a one-time setup:
22
24
23
-
Generate an API key at [bitrefill.com/account/developers](https://www.bitrefill.com/account/developers) and pass it via the `--api-key` option or the `BITREFILL_API_KEY` environment variable. This skips the OAuth flow entirely.
25
+
1. Prompts for your API key (masked input) -- get one at [bitrefill.com/account/developers](https://www.bitrefill.com/account/developers)
26
+
2. Validates the key against the Bitrefill MCP server
27
+
3. Stores the key in `~/.config/bitrefill-cli/credentials.json` (permissions `0600`)
28
+
4. If [OpenClaw](https://github.com/openclaw/openclaw) is detected, registers Bitrefill as an MCP server and generates a `SKILL.md` for agents
24
29
25
-
### Non-interactive / CI
30
+
Non-interactive and agent-driven usage:
31
+
32
+
```bash
33
+
# Pass the key directly (scripts, CI, OpenClaw agents)
# Force OpenClaw integration even if not auto-detected
41
+
bitrefill init --openclaw
42
+
```
43
+
44
+
After `init`, the stored key is picked up automatically -- no need to pass `--api-key` on every invocation.
45
+
46
+
### OpenClaw + Telegram
47
+
48
+
If you use [OpenClaw](https://github.com/openclaw/openclaw) as your AI agent gateway (e.g. via Telegram), `bitrefill init` does extra work:
49
+
50
+
- Writes `BITREFILL_API_KEY` to `~/.openclaw/.env` (read by the gateway at activation)
51
+
- Adds an MCP server entry to `~/.openclaw/openclaw.json` using `${BITREFILL_API_KEY}` -- the config file never contains the actual key
52
+
- Generates `~/.openclaw/skills/bitrefill/SKILL.md` so the agent knows about all available tools
26
53
27
-
In environments without a TTY (e.g. CI, Docker, scripts), or when `CI=true`, the CLI cannot complete browser-based OAuth. Pass `--no-interactive` to fail fast with a clear message, or use `--api-key` / `BITREFILL_API_KEY` instead.
54
+
After init, tell your Telegram bot: *"Search for Netflix gift cards on Bitrefill"*.
55
+
56
+
## Authentication
57
+
58
+
### API Key (recommended)
59
+
60
+
Generate an API key at [bitrefill.com/account/developers](https://www.bitrefill.com/account/developers). After running `bitrefill init`, the key is stored locally and used automatically.
# Or copy .env.example to .env and fill in your key
38
-
cp .env.example .env
39
71
```
40
72
73
+
Key resolution priority: `--api-key` flag > `BITREFILL_API_KEY` env var > stored credentials file.
74
+
75
+
### OAuth
76
+
77
+
On first run without an API key, the CLI opens your browser for OAuth authorization. Credentials are stored in `~/.config/bitrefill-cli/`.
78
+
79
+
### Non-interactive / CI
80
+
81
+
In environments without a TTY (e.g. CI, Docker, scripts), or when `CI=true`, the CLI cannot complete browser-based OAuth. Use `bitrefill init` first, or pass `--api-key` / `BITREFILL_API_KEY`.
82
+
41
83
Node does not load `.env` files automatically. After editing `.env`, either export variables in your shell (`set -a && source .env && set +a` in bash/zsh) or pass `--api-key` on the command line.
0 commit comments