aiopt 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 +47 -19
- package/dist/cli.js +534 -385
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AIOpt — install-first LLM cost guardrails (local-only)
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/aiopt)
|
|
4
4
|
[](https://github.com/tkddlr0716-collab/aiopt/actions/workflows/ci.yml)
|
|
5
5
|
[](./LICENSE)
|
|
6
6
|
|
|
7
|
+
**3-line quickstart (5 minutes)**
|
|
7
8
|
```bash
|
|
8
|
-
npx aiopt
|
|
9
|
+
npx aiopt install --force
|
|
10
|
+
npx aiopt doctor
|
|
9
11
|
npx aiopt scan
|
|
10
|
-
cat ./aiopt-output/report.txt
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
AIOpt is a **serverless local CLI**.
|
|
14
15
|
- No signup, no upload, no dashboard, no server deployment.
|
|
15
16
|
- Reads local JSONL/CSV → writes local outputs.
|
|
16
17
|
- **No LLM calls** (math + deterministic rules only).
|
|
17
18
|
|
|
19
|
+
Landing (demo): https://scoopingly-subcancellous-sunny.ngrok-free.dev/landing/
|
|
20
|
+
Docs: `aiopt/README.md` (install-first guide)
|
|
21
|
+
Pricing/flow: `docs/PRODUCT_PRICING_AND_FLOW.md`
|
|
22
|
+
|
|
18
23
|
## What you get
|
|
19
24
|
After `scan`, you will have:
|
|
20
25
|
1) `./aiopt-output/analysis.json` (top cost by feature/model)
|
|
21
|
-
2) `./aiopt-output/report.
|
|
22
|
-
3) `./aiopt-output/
|
|
26
|
+
2) `./aiopt-output/report.md` (WHAT TO CHANGE)
|
|
27
|
+
3) `./aiopt-output/report.json` (machine-readable summary)
|
|
28
|
+
4) `./aiopt-output/patches/*` (policy patch stubs)
|
|
29
|
+
5) `./aiopt-output/cost-policy.json` (policy file)
|
|
23
30
|
|
|
24
31
|
### Sample `report.txt`
|
|
25
32
|
```
|
|
@@ -28,18 +35,36 @@ After `scan`, you will have:
|
|
|
28
35
|
절감 근거 3줄:
|
|
29
36
|
a) 모델 라우팅 절감(추정): $0.07
|
|
30
37
|
b) 컨텍스트 감축(추정): $0.02 (상위 20% input에 25% 감축 가정)
|
|
31
|
-
c) 재시도/오류
|
|
38
|
+
c) 재시도/오류 낭비(상한 적용): $0.13
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Sample console output
|
|
42
|
+
```
|
|
43
|
+
Top Fix 3:
|
|
44
|
+
1) Retry tuning ($0.01)
|
|
45
|
+
2) Output cap (no issue detected)
|
|
46
|
+
3) Routing rule (no issue detected)
|
|
47
|
+
Report: aiopt-output/report.md
|
|
32
48
|
```
|
|
33
49
|
|
|
34
50
|
## Input (default)
|
|
35
|
-
- Default path: `./aiopt-
|
|
51
|
+
- Default path: `./aiopt-output/usage.jsonl`
|
|
36
52
|
- Change: `npx aiopt scan --input <path>`
|
|
37
53
|
- Supported: JSONL (1 event per line), CSV
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
AIOpt supports both:
|
|
56
|
+
- aggregated logs: `input_tokens/output_tokens/feature_tag/retries`
|
|
57
|
+
- wrapper logs: `prompt_tokens/completion_tokens/endpoint/attempt/trace_id/cost_usd`
|
|
58
|
+
|
|
59
|
+
### Required fields (minimal)
|
|
60
|
+
For aggregated logs:
|
|
61
|
+
- `ts, provider, model, input_tokens, output_tokens, feature_tag, retries, status`
|
|
62
|
+
|
|
63
|
+
For wrapper logs:
|
|
64
|
+
- `ts, provider, model, prompt_tokens, completion_tokens, endpoint, attempt, trace_id, status`
|
|
41
65
|
|
|
42
|
-
|
|
66
|
+
Optional:
|
|
67
|
+
- `billed_cost` (aggregated) or `cost_usd` (wrapper)
|
|
43
68
|
|
|
44
69
|
### JSONL example (5 lines)
|
|
45
70
|
```jsonl
|
|
@@ -50,17 +75,20 @@ c) 재시도/오류 낭비: $0.13 (retries 기반)
|
|
|
50
75
|
{"ts":"2026-02-07T00:00:05Z","provider":"openai","model":"unknown-model-x","input_tokens":8000,"output_tokens":1000,"feature_tag":"summarize","retries":2,"status":"error"}
|
|
51
76
|
```
|
|
52
77
|
|
|
53
|
-
## Outputs
|
|
78
|
+
## Outputs
|
|
54
79
|
- `analysis.json`
|
|
55
80
|
- `total_cost`
|
|
56
81
|
- `by_model_top` (top 10)
|
|
57
82
|
- `by_feature_top` (top 10)
|
|
58
83
|
- `unknown_models`
|
|
59
84
|
- `rate_table_version`, `rate_table_date`
|
|
60
|
-
- `report.
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
|
|
85
|
+
- `report.md`
|
|
86
|
+
- WHAT TO CHANGE (file paths + keys)
|
|
87
|
+
- confidence + assumptions
|
|
88
|
+
- `report.json`
|
|
89
|
+
- summary + warnings + assumptions
|
|
90
|
+
- `patches/*`
|
|
91
|
+
- `policies.updated.*` stubs
|
|
64
92
|
- `cost-policy.json`
|
|
65
93
|
- `version, default_provider, rules, budgets, generated_from`
|
|
66
94
|
|
|
@@ -74,9 +102,9 @@ c) 재시도/오류 낭비: $0.13 (retries 기반)
|
|
|
74
102
|
|
|
75
103
|
## Local dev
|
|
76
104
|
```bash
|
|
77
|
-
cd aiopt
|
|
78
105
|
npm i
|
|
79
106
|
npm run build
|
|
80
|
-
node dist/cli.js
|
|
81
|
-
node dist/cli.js
|
|
107
|
+
node dist/cli.js install --force
|
|
108
|
+
node dist/cli.js doctor
|
|
109
|
+
node dist/cli.js scan
|
|
82
110
|
```
|