@inferall/cli 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -15
- package/bin/build-info.json +1 -0
- package/bin/inferall.js +2734 -153
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -8,35 +8,53 @@ npx @inferall/cli init
|
|
|
8
8
|
|
|
9
9
|
The wizard:
|
|
10
10
|
|
|
11
|
-
1. **Detects your project
|
|
12
|
-
`openai`, `@anthropic-ai/sdk`,
|
|
13
|
-
|
|
11
|
+
1. **Detects your project.** Node or Python, and whether you already use the
|
|
12
|
+
`openai`, `@anthropic-ai/sdk`, `@google/generative-ai`, `@google/genai`,
|
|
13
|
+
`ai` (Vercel AI SDK), or `@inferall/sdk` packages. On Python it also reads
|
|
14
|
+
your imports, so LangChain projects are picked up even though they declare
|
|
15
|
+
`langchain-openai` rather than `openai`. Detection reads your source as well
|
|
16
|
+
as your manifest, so a project that has not run `npm install` yet is still
|
|
17
|
+
handled.
|
|
18
|
+
2. **Sets up your key.** Writes `INFERALL_API_KEY` to `.env`, adds a
|
|
14
19
|
placeholder to `.env.example`, and makes sure `.env` is gitignored.
|
|
15
|
-
3. **Migrates existing code
|
|
20
|
+
3. **Migrates existing code.** Points `OpenAI` and `Anthropic` client
|
|
16
21
|
constructors at the InferAll gateway (the OpenAI SDK gets
|
|
17
22
|
`https://api.inferall.ai/v1`; the Anthropic SDK gets the host root since it
|
|
18
23
|
appends `/v1/messages` itself). Simple constructors are rewritten
|
|
19
24
|
deterministically; anything ambiguous gets an AI-suggested patch (generated
|
|
20
|
-
by InferAll's own $0 NIM models
|
|
21
|
-
review before it's applied. Google Gemini SDK usage is detected too
|
|
25
|
+
by InferAll's own $0 NIM models, so the wizard dogfoods the gateway) that you
|
|
26
|
+
review before it's applied. Google Gemini SDK usage is detected too, and that
|
|
22
27
|
SDK speaks its own protocol, so instead of a risky rewrite you get the exact
|
|
23
28
|
OpenAI-compat snippet (`model: "gemini/gemini-2.5-flash"`) to migrate at
|
|
24
29
|
your own pace.
|
|
25
|
-
4. **Verifies with a live call
|
|
26
|
-
|
|
30
|
+
4. **Verifies with a live call.** A new key gets a small number of free calls
|
|
31
|
+
(currently 25) on the $0 NIM models before any card is needed, so the wizard
|
|
32
|
+
finishes with a real response rather than a payment wall. It reports your
|
|
33
|
+
actual trial state, and when the free calls run out it says exactly that,
|
|
34
|
+
with the link, instead of failing opaquely.
|
|
27
35
|
|
|
28
36
|
## Commands
|
|
29
37
|
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
For a project with no existing AI client, `init` writes a first-request example:
|
|
39
|
+
`node inferall-hello.mjs` or `python3 inferall_hello.py`. Both use built-in
|
|
40
|
+
libraries, read your exported key or the `.env` beside the example, and select
|
|
41
|
+
the free model explicitly. A refusal or empty response exits nonzero and prints
|
|
42
|
+
an explanation to stderr. Existing example files are left intact.
|
|
43
|
+
|
|
44
|
+
- `init`: the wizard above (default).
|
|
45
|
+
- `doctor`: health-check an existing setup. Key present and valid, `.env`
|
|
32
46
|
gitignore hygiene, whether every client call site points at the gateway, and
|
|
33
47
|
a live call that reports your real account state (active vs `$5` activation
|
|
34
|
-
pending). Exit code 0 only when everything passes
|
|
35
|
-
- `models
|
|
48
|
+
pending). Exit code 0 only when everything passes, so it is CI-friendly.
|
|
49
|
+
- `models`: the live model list with real prices, straight from the gateway.
|
|
36
50
|
`--free` shows only the $0 models; `--json` gives the raw pricing map.
|
|
37
|
-
- `status
|
|
51
|
+
- `status`: your account state from the key's point of view. Tier, activation,
|
|
38
52
|
balance, trial calls remaining, and what the free models saved you this week.
|
|
39
53
|
The fast answer to "did my payment land?"
|
|
54
|
+
- `chat`: one-shot chat from the terminal, `npx @inferall/cli chat "explain X"`
|
|
55
|
+
(or pipe stdin: `echo "hi" | npx @inferall/cli chat`). The fastest way to
|
|
56
|
+
confirm your key works and see a real response. Runs on a $0 NIM model by
|
|
57
|
+
default, `--model id` to pick another.
|
|
40
58
|
|
|
41
59
|
## Flags
|
|
42
60
|
|
|
@@ -46,10 +64,29 @@ The wizard:
|
|
|
46
64
|
| `--yes` / `-y` | Accept all defaults (non-interactive) |
|
|
47
65
|
| `--no-ai` | Deterministic codemod only, no AI-suggested patches |
|
|
48
66
|
|
|
67
|
+
## In CI
|
|
68
|
+
|
|
69
|
+
`doctor` exits non-zero when anything's off (missing/invalid key, un-gitignored
|
|
70
|
+
`.env`, call sites bypassing the gateway, account not activated), so it works
|
|
71
|
+
as a CI guard:
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
# .github/workflows/inferall-check.yml
|
|
75
|
+
- name: Check InferAll wiring
|
|
76
|
+
run: npx @inferall/cli doctor
|
|
77
|
+
env:
|
|
78
|
+
INFERALL_API_KEY: ${{ secrets.INFERALL_API_KEY }}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`init --yes --no-ai` is fully non-interactive (deterministic codemod only) if
|
|
82
|
+
you need setup in a script.
|
|
83
|
+
|
|
49
84
|
## Why this exists
|
|
50
85
|
|
|
51
86
|
Most gateways make you read docs to change one line. This makes the one-line
|
|
52
|
-
change for you,
|
|
53
|
-
your
|
|
87
|
+
change for you, gets you a real response on the free calls before asking for a
|
|
88
|
+
card, tells you the truth about your account state when the $5 activation does
|
|
89
|
+
apply, and leaves your code otherwise untouched, with no reformatting and no
|
|
90
|
+
renames.
|
|
54
91
|
|
|
55
92
|
Zero runtime dependencies. Node 18+.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"sha":"51fd6a7","ref":"main","offMain":null}
|