cheapgen 0.1.1 → 0.2.0
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 +131 -111
- package/data/frame-sizes.json +52 -0
- package/data/models.json +397 -28
- package/data/prices.json +526 -42
- package/package.json +4 -3
- package/skills/cheapgen/SKILL.md +43 -6
- package/src/catalog.js +28 -0
- package/src/cli/commands/config.js +9 -6
- package/src/cli/commands/index.js +24 -5
- package/src/cli/commands/info.js +11 -3
- package/src/cli/commands/mcp.js +21 -0
- package/src/cli/commands/quote.js +18 -5
- package/src/cli/commands/run.js +46 -7
- package/src/cli/commands/shared.js +2 -1
- package/src/cli/commands/skill.js +141 -0
- package/src/cli/main.js +11 -4
- package/src/config.js +32 -6
- package/src/http.js +1 -1
- package/src/mcp/errors.js +8 -0
- package/src/mcp/server.js +144 -0
- package/src/mcp/stdio.js +41 -0
- package/src/mcp/tools.js +383 -0
- package/src/media.js +231 -0
- package/src/pricing/check.js +14 -8
- package/src/pricing/formulas.js +26 -0
- package/src/pricing/index.js +5 -2
- package/src/providers/common.js +47 -6
- package/src/providers/errors.js +6 -2
- package/src/providers/fal.js +31 -14
- package/src/providers/higgsfield.js +250 -0
- package/src/providers/index.js +55 -5
- package/src/providers/kie.js +48 -14
- package/src/providers/replicate.js +15 -10
- package/src/providers/wavespeed.js +21 -14
- package/src/request.js +276 -23
package/README.md
CHANGED
|
@@ -1,160 +1,179 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/jzr-supove/cheapgen/main/docs/images/banner.webp" alt="cheapgen" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/cheapgen"><img src="https://img.shields.io/npm/v/cheapgen?label=npm&color=FF7A1A" alt="npm version"></a>
|
|
7
|
+
<a href="https://github.com/jzr-supove/cheapgen/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-FF7A1A" alt="MIT license"></a>
|
|
8
|
+
<img src="https://img.shields.io/badge/node-22%2B-FF7A1A" alt="Node.js 22 or newer">
|
|
9
|
+
<img src="https://img.shields.io/badge/dependencies-0-FF7A1A" alt="No dependencies">
|
|
10
|
+
</p>
|
|
2
11
|
|
|
3
12
|
Several API providers sell the same AI video and image models at different prices. `cheapgen`
|
|
4
13
|
prices your request on each provider you have a key for and sends it to the cheapest one.
|
|
5
14
|
|
|
6
|
-
It works with [Kie](https://kie.ai), [Replicate](https://replicate.com),
|
|
7
|
-
[WaveSpeed](https://wavespeed.ai) and [fal](https://fal.ai).
|
|
8
|
-
|
|
9
15
|
```console
|
|
10
|
-
$ cheapgen quote seedance-2.0
|
|
11
|
-
seedance-2.0
|
|
12
|
-
|
|
13
|
-
replicate
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
$ cheapgen quote seedance-2.0 --res 720p --duration 5
|
|
17
|
+
seedance-2.0 · text-to-video · 720p · 5s · 16:9 · audio on
|
|
18
|
+
higgsfield $0.867 live 2026-12-05 ← run would use this
|
|
19
|
+
replicate $0.900 bundled 2026-11-21
|
|
20
|
+
kie $1.025 live 2026-12-05
|
|
21
|
+
wavespeed $1.080 live 2026-12-05
|
|
22
|
+
fal $1.512 bundled 2026-11-21
|
|
16
23
|
```
|
|
17
24
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
> requests were built from its docs.
|
|
21
|
-
|
|
22
|
-
## Install
|
|
25
|
+
The same model and the same request: $0.87 on the cheapest provider that day, $1.51 on the
|
|
26
|
+
dearest.
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```
|
|
28
|
+
It works with [Kie](https://kie.ai), [Replicate](https://replicate.com),
|
|
29
|
+
[WaveSpeed](https://wavespeed.ai), [fal](https://fal.ai) and the
|
|
30
|
+
[Higgsfield](https://higgsfield.ai) API, from the command line or from a coding agent such as
|
|
31
|
+
Claude Code, Codex, GitHub Copilot or Cursor.
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
> **Early version.** Not every feature has been run for real on every provider yet. See
|
|
34
|
+
> [what has been tried](#what-has-been-tried).
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
## How it works
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
cheapgen
|
|
36
|
-
|
|
38
|
+
<p align="center">
|
|
39
|
+
<img src="https://raw.githubusercontent.com/jzr-supove/cheapgen/main/docs/images/routing.svg" alt="Your request is priced on every provider and sent to the cheapest. If that provider refuses it, the next cheapest is tried. If it is unclear whether a job was created, cheapgen stops." width="100%">
|
|
40
|
+
</p>
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
`~/.cheapgen/config.json`, readable only by you on macOS and Linux. Windows can't restrict it the
|
|
40
|
-
same way.
|
|
42
|
+
## Quick start
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
`WAVESPEED_API_KEY`, `FAL_KEY`.
|
|
44
|
+
You need [Node.js](https://nodejs.org) 22 or newer. There are no other dependencies.
|
|
44
45
|
|
|
45
46
|
```sh
|
|
46
|
-
|
|
47
|
-
cheapgen config get-key kie # is this key set, and where does it come from?
|
|
48
|
-
cheapgen providers # connected providers and their balances
|
|
49
|
-
```
|
|
47
|
+
npm install -g cheapgen
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
# Add a key from at least one provider: kie, replicate, wavespeed, fal or higgsfield
|
|
50
|
+
cheapgen config set-key kie
|
|
52
51
|
|
|
53
|
-
```sh
|
|
54
52
|
# What would it cost, and where? Sends nothing to generate.
|
|
55
53
|
cheapgen quote seedance-2.0-mini --res 480p --duration 4
|
|
56
54
|
|
|
57
|
-
# See the exact request without sending it.
|
|
58
|
-
cheapgen run seedance-2.0-mini --prompt "a paper boat on a pond" --res 480p --duration 4 --dry-run
|
|
59
|
-
|
|
60
55
|
# Generate, wait, and save the result to ./cheapgen-out
|
|
61
56
|
cheapgen run seedance-2.0-mini --prompt "a paper boat on a pond" --res 480p --duration 4 --wait
|
|
57
|
+
```
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
`set-key` asks for the key and hides what you type. Environment variables work too. A Higgsfield
|
|
60
|
+
key has two parts. [Providers and keys](https://github.com/jzr-supove/cheapgen/blob/main/docs/providers.md)
|
|
61
|
+
has the details.
|
|
65
62
|
|
|
66
|
-
|
|
67
|
-
cheapgen run seedance-2.0-mini --prompt "the boat drifts away" --image boat.png --wait
|
|
63
|
+
## What it can do
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
Start from `cheapgen run <model> --prompt "..."` and add:
|
|
66
|
+
|
|
67
|
+
| To make | Add | Guide |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| An image or a video from text | nothing | [Commands](https://github.com/jzr-supove/cheapgen/blob/main/docs/commands.md) |
|
|
70
|
+
| An edited image, or several combined | `--image photo.png`, repeated to combine | [Editing images](https://github.com/jzr-supove/cheapgen/blob/main/docs/image-editing.md) |
|
|
71
|
+
| A video that starts from an image | `--image boat.png` | [Video inputs](https://github.com/jzr-supove/cheapgen/blob/main/docs/video-inputs.md) |
|
|
72
|
+
| A video between two frames | `--image day.png --last-image night.png` | [Video inputs](https://github.com/jzr-supove/cheapgen/blob/main/docs/video-inputs.md) |
|
|
73
|
+
| A video from reference images and audio | `--ref-image hero.png --ref-audio voice.wav` | [Video inputs](https://github.com/jzr-supove/cheapgen/blob/main/docs/video-inputs.md) |
|
|
74
|
+
|
|
75
|
+
<p align="center">
|
|
76
|
+
<img src="https://raw.githubusercontent.com/jzr-supove/cheapgen/main/docs/images/video-inputs.svg" alt="Three ways to steer a video: a first frame, a first and a last frame, or reference images and audio" width="100%">
|
|
77
|
+
</p>
|
|
78
|
+
|
|
79
|
+
- **Local files or URLs.** A local file is uploaded to the provider that runs the job, and to no
|
|
80
|
+
other.
|
|
81
|
+
- **Start now, collect later.** Without `--wait`, `run` prints a job id. `cheapgen wait <job>`
|
|
82
|
+
collects the result.
|
|
83
|
+
- **See before you send.** `--dry-run` shows the exact request and the estimate, and sends
|
|
84
|
+
nothing.
|
|
73
85
|
|
|
74
86
|
`cheapgen --help` lists every option. Add `--json` to any command for scripts.
|
|
75
87
|
|
|
76
88
|
## Models
|
|
77
89
|
|
|
78
|
-
| Video |
|
|
79
|
-
|
|
80
|
-
| `seedance-2.0-mini` |
|
|
81
|
-
| `seedance-2.0-fast` |
|
|
82
|
-
| `seedance-2.0` |
|
|
83
|
-
| `seedance-2.5-flash` |
|
|
84
|
-
| `seedance-2.5` |
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
| Video model | Resolutions | Kie | Replicate | WaveSpeed | fal | Higgsfield |
|
|
91
|
+
|---|---|:-:|:-:|:-:|:-:|:-:|
|
|
92
|
+
| `seedance-2.0-mini` | 480p, 720p | ✓ | ✓ | ✓ | ✓ | |
|
|
93
|
+
| `seedance-2.0-fast` | 480p, 720p | ✓ | ✓ | ✓ | ✓ | |
|
|
94
|
+
| `seedance-2.0` | 480p, 720p, 1080p, 4k | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
95
|
+
| `seedance-2.5-flash` | 480p, 720p | ✓ | | ✓ | ✓ | |
|
|
96
|
+
| `seedance-2.5` | 480p, 720p, 1080p, 4k | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
97
|
+
|
|
98
|
+
| Image model | Sizes | Kie | Replicate | WaveSpeed | fal | Higgsfield |
|
|
99
|
+
|---|---|:-:|:-:|:-:|:-:|:-:|
|
|
100
|
+
| `seedream-5.5` | 1K, 1.5K, 2K | ✓ | | ✓ | ✓ | |
|
|
101
|
+
| `seedream-5-pro` | 1K, 2K | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
102
|
+
| `seedream-5-lite` | 2K, 3K, 4K | ✓ | ✓ | ✓ | ✓ | |
|
|
103
|
+
| `nano-banana-2.1` | 1K, 2K, 4K | ✓ | ✓ | ✓ | ✓ | |
|
|
104
|
+
| `nano-banana-pro` | 1K, 2K, 4K | ✓ | ✓ | ✓ | ✓ | |
|
|
105
|
+
| `flux-2-pro` | 1K, 2K | ✓ | ✓ | ✓ | ✓ | |
|
|
106
|
+
|
|
107
|
+
`cheapgen models` shows the same list, with the providers you have a key for marked.
|
|
108
|
+
|
|
109
|
+
- **4K video** (`--res 4k`) costs about $1 to $1.10 a second at the cheapest provider. The file is
|
|
110
|
+
10-bit H.265/HEVC, which some players can't open; VLC and mpv can.
|
|
111
|
+
- **Upscaled 1080p and 4K.** WaveSpeed also sells these for the mini, fast and flash models,
|
|
112
|
+
upscaled from 720p. They are off by default; see
|
|
113
|
+
[Configuration](https://github.com/jzr-supove/cheapgen/blob/main/docs/configuration.md#upscaled-resolutions).
|
|
88
114
|
|
|
89
115
|
## Spending safely
|
|
90
116
|
|
|
91
|
-
- **Cost limit.** A run that costs more than $1, or whose price is unknown, stops until you
|
|
92
|
-
it. Change the limit with `cheapgen config set maxCostPerRun 0.5`, or for one run with
|
|
117
|
+
- **Cost limit.** A run that costs more than $1, or whose price is unknown, stops until you
|
|
118
|
+
confirm it. Change the limit with `cheapgen config set maxCostPerRun 0.5`, or for one run with
|
|
93
119
|
`--max-cost`. `--yes` starts a run even if it is over the limit.
|
|
94
120
|
- **No double billing.** If a provider clearly rejects a request, cheapgen tries the next cheapest
|
|
95
121
|
one. If it can't tell whether the job was created, it stops and says so (exit code 5) instead of
|
|
96
122
|
risking a second charge.
|
|
97
|
-
- **Balances.** Providers whose reported balance can't cover the request are skipped. Replicate
|
|
98
|
-
no balance API.
|
|
99
|
-
- **Spend log.** `cheapgen spend` summarizes your runs
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
## Configuration
|
|
108
|
-
|
|
109
|
-
Settings live in `~/.cheapgen/config.json`. A `.cheapgen.json` in the current folder overrides them.
|
|
110
|
-
|
|
111
|
-
```json
|
|
112
|
-
{
|
|
113
|
-
"strategy": "cheapest",
|
|
114
|
-
"prefer": ["kie", "replicate"],
|
|
115
|
-
"maxCostPerRun": 1.0,
|
|
116
|
-
"providers": { "fal": { "enabled": false } },
|
|
117
|
-
"models": { "seedance-2.5": { "provider": "replicate" } }
|
|
118
|
-
}
|
|
119
|
-
```
|
|
123
|
+
- **Balances.** Providers whose reported balance can't cover the request are skipped. Replicate and
|
|
124
|
+
Higgsfield have no balance API, so a request they can't cover is only refused when it is sent.
|
|
125
|
+
- **Spend log.** `cheapgen spend` summarizes your runs. The log stays on your computer and never
|
|
126
|
+
contains prompts or keys.
|
|
127
|
+
|
|
128
|
+
Every price is an estimate and is shown with its source and date. Kie, WaveSpeed, fal and
|
|
129
|
+
Higgsfield prices are read live when possible; otherwise cheapgen uses the prices bundled in
|
|
130
|
+
`data/prices.json`. Your provider's bill is authoritative.
|
|
131
|
+
|
|
132
|
+
## What has been tried
|
|
120
133
|
|
|
121
|
-
|
|
122
|
-
request.
|
|
123
|
-
- `providers.<id>.enabled`: turn a provider off without removing its key.
|
|
124
|
-
- `models.<id>.provider`: always use one provider for a model.
|
|
134
|
+
Real runs so far, as of 2026-12-05:
|
|
125
135
|
|
|
126
|
-
|
|
136
|
+
| | Kie | Replicate | WaveSpeed | fal | Higgsfield |
|
|
137
|
+
|---|:-:|:-:|:-:|:-:|:-:|
|
|
138
|
+
| Image | ✓ | ✓ | ✓ | not yet | ✓ |
|
|
139
|
+
| Image edit | ✓ | ✓ | ✓ | not yet | ✓ |
|
|
140
|
+
| Text-to-video | ✓ | ✓ | ✓ | not yet | not yet |
|
|
141
|
+
| Image-to-video | ✓ | ✓ | ✓ | not yet | not yet |
|
|
142
|
+
| First and last frame | ✓ | ✓ | ✓ | not yet | ✓ |
|
|
143
|
+
| Reference images and audio | ✓ | refused | ✓ | not yet | ✓ |
|
|
127
144
|
|
|
128
|
-
|
|
145
|
+
fal has been tried for prices, balance and errors; its generation requests were built from its
|
|
146
|
+
docs. On Replicate the reference request was accepted, but the model refused the result.
|
|
147
|
+
[Providers and keys](https://github.com/jzr-supove/cheapgen/blob/main/docs/providers.md#what-has-been-tried-with-real-runs)
|
|
148
|
+
has the full notes.
|
|
129
149
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
150
|
+
## Use with AI agents
|
|
151
|
+
|
|
152
|
+
A coding agent can quote and run generations for you. It quotes first and asks before spending
|
|
153
|
+
anything.
|
|
133
154
|
|
|
134
155
|
```sh
|
|
135
|
-
#
|
|
136
|
-
|
|
137
|
-
cp -r "$(npm root -g)/cheapgen/skills/cheapgen" ~/.claude/skills/
|
|
138
|
-
```
|
|
156
|
+
# The skill, for the agents on your computer
|
|
157
|
+
cheapgen skill install
|
|
139
158
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Copy-Item -Recurse -Force "$(npm root -g)\cheapgen\skills\cheapgen" "$HOME\.claude\skills\"
|
|
159
|
+
# Or the plugin for Claude Code, inside a session (no install needed)
|
|
160
|
+
/plugin marketplace add jzr-supove/cheapgen
|
|
161
|
+
/plugin install cheapgen@cheapgen
|
|
144
162
|
```
|
|
145
163
|
|
|
146
|
-
|
|
164
|
+
There are plugins for Codex, GitHub Copilot, Cursor, Antigravity and Gemini CLI too, and an MCP
|
|
165
|
+
server (`cheapgen mcp`) for apps that use MCP tools.
|
|
166
|
+
[Use with AI agents](https://github.com/jzr-supove/cheapgen/blob/main/docs/agents.md) covers all
|
|
167
|
+
three.
|
|
168
|
+
|
|
169
|
+
## Guides
|
|
147
170
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
| 4 | Needs confirmation: over the cost limit, or the price is unknown |
|
|
155
|
-
| 5 | Unknown outcome: a job may exist. Check the provider before trying again |
|
|
156
|
-
| 6 | The job failed |
|
|
157
|
-
| 7 | Timed out waiting; the job may still finish |
|
|
171
|
+
- [Providers and keys](https://github.com/jzr-supove/cheapgen/blob/main/docs/providers.md): keys, prices, balances, what has been tried
|
|
172
|
+
- [Commands](https://github.com/jzr-supove/cheapgen/blob/main/docs/commands.md): every command and option, exit codes
|
|
173
|
+
- [Editing images](https://github.com/jzr-supove/cheapgen/blob/main/docs/image-editing.md): edit one picture or combine several
|
|
174
|
+
- [Video from frames and references](https://github.com/jzr-supove/cheapgen/blob/main/docs/video-inputs.md): first frame, last frame, reference images and audio
|
|
175
|
+
- [Configuration](https://github.com/jzr-supove/cheapgen/blob/main/docs/configuration.md): every setting
|
|
176
|
+
- [Use with AI agents](https://github.com/jzr-supove/cheapgen/blob/main/docs/agents.md): the skill, the plugins and the MCP server
|
|
158
177
|
|
|
159
178
|
## Development
|
|
160
179
|
|
|
@@ -166,4 +185,5 @@ Tests make no network calls and spend no credits.
|
|
|
166
185
|
|
|
167
186
|
## License
|
|
168
187
|
|
|
169
|
-
[MIT](LICENSE). cheapgen is not affiliated with
|
|
188
|
+
[MIT](https://github.com/jzr-supove/cheapgen/blob/main/LICENSE). cheapgen is not affiliated with
|
|
189
|
+
Kie, Replicate, WaveSpeed, fal or Higgsfield.
|
package/data/frame-sizes.json
CHANGED
|
@@ -78,6 +78,32 @@
|
|
|
78
78
|
2206,
|
|
79
79
|
946
|
|
80
80
|
]
|
|
81
|
+
},
|
|
82
|
+
"4k": {
|
|
83
|
+
"16:9": [
|
|
84
|
+
3840,
|
|
85
|
+
2160
|
|
86
|
+
],
|
|
87
|
+
"9:16": [
|
|
88
|
+
2160,
|
|
89
|
+
3840
|
|
90
|
+
],
|
|
91
|
+
"1:1": [
|
|
92
|
+
2880,
|
|
93
|
+
2880
|
|
94
|
+
],
|
|
95
|
+
"4:3": [
|
|
96
|
+
3326,
|
|
97
|
+
2494
|
|
98
|
+
],
|
|
99
|
+
"3:4": [
|
|
100
|
+
2494,
|
|
101
|
+
3326
|
|
102
|
+
],
|
|
103
|
+
"21:9": [
|
|
104
|
+
4398,
|
|
105
|
+
1886
|
|
106
|
+
]
|
|
81
107
|
}
|
|
82
108
|
},
|
|
83
109
|
"seedance-2.5": {
|
|
@@ -158,6 +184,32 @@
|
|
|
158
184
|
2206,
|
|
159
185
|
946
|
|
160
186
|
]
|
|
187
|
+
},
|
|
188
|
+
"4k": {
|
|
189
|
+
"16:9": [
|
|
190
|
+
3840,
|
|
191
|
+
2160
|
|
192
|
+
],
|
|
193
|
+
"9:16": [
|
|
194
|
+
2160,
|
|
195
|
+
3840
|
|
196
|
+
],
|
|
197
|
+
"1:1": [
|
|
198
|
+
2880,
|
|
199
|
+
2880
|
|
200
|
+
],
|
|
201
|
+
"4:3": [
|
|
202
|
+
3326,
|
|
203
|
+
2494
|
|
204
|
+
],
|
|
205
|
+
"3:4": [
|
|
206
|
+
2494,
|
|
207
|
+
3326
|
|
208
|
+
],
|
|
209
|
+
"21:9": [
|
|
210
|
+
4398,
|
|
211
|
+
1886
|
|
212
|
+
]
|
|
161
213
|
}
|
|
162
214
|
},
|
|
163
215
|
"seedream-5.5": {
|