Cap the cost
Each model call has a cost in tokens. jcode counts four kinds: input, output, cache read, and cache write. It shows the USD of each agent from the prices of config.json.
See the cost
list shows the tokens and the USD of each agent. cost ID prints a table in Markdown, for the body of a pull request:
jcode cost a1
| Item | Tokens | USD |
|---|---:|---:|
| input | 3429 | 0.0038 |
| output | 266 | 0.0009 |
| cache read | 0 | 0.0000 |
| cache write | 1035 | 0.0014 |
| **Total** | | **0.0061** |
| Model calls | Wall time | In model calls | In tools | Waiting for the coordinator |
|---:|---:|---:|---:|---:|
| 5 | 9 s | 9 s | 0 s | 0 s |
Set a cap
start has two caps. An agent past a cap goes to the state capped with the reason, and it cannot go on.
| Option | What it caps | Default |
|---|---|---|
--max-turns N |
The count of model calls. | 40 |
--max-tokens N |
The sum of the four token counts. | 400000 |
--max-out N |
The output tokens of one model call. A reply that stops at the cap with no text gets one more try with twice the cap, up to 32000. | 4096 |
jcode start --dir hello --model us.amazon.ergo-1.0 --brief brief.md --max-turns 20 --max-tokens 200000
Set the prices
The default prices are for us.amazon.ergo-1.0. For another model, add its prices in USD for 1M tokens to config.json of the state folder:
{"prices": {"us.amazon.ergo-1.0": {"in": 1.10, "out": 3.30, "cache_read": 0.033, "cache_write": 1.375}}}
A model with no price shows no USD.