opencode-token-tracker 1.3.0 → 1.3.1

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 CHANGED
@@ -183,6 +183,35 @@ Create a config file at `~/.config/opencode/token-tracker.json`:
183
183
  }
184
184
  ```
185
185
 
186
+ ### Pricing Fields Explained
187
+
188
+ All prices are in **USD per 1 million tokens**:
189
+
190
+ | Field | Description | Example |
191
+ |-------|-------------|---------|
192
+ | `input` | Cost for input/prompt tokens | `15` = $15 per 1M tokens |
193
+ | `output` | Cost for output/completion tokens | `75` = $75 per 1M tokens |
194
+ | `cacheRead` | Cost for cached input tokens (optional) | `1.5` = $1.5 per 1M tokens |
195
+ | `cacheWrite` | Cost for cache write tokens (optional) | `18.75` = $18.75 per 1M tokens |
196
+
197
+ **How to find pricing for your model:**
198
+
199
+ 1. Check the provider's official pricing page:
200
+ - [Anthropic Claude](https://www.anthropic.com/pricing)
201
+ - [OpenAI](https://openai.com/pricing)
202
+ - [DeepSeek](https://platform.deepseek.com/api-docs/pricing)
203
+ - [Google Gemini](https://ai.google.dev/pricing)
204
+
205
+ 2. Or run `opencode-tokens pricing` to see built-in prices
206
+
207
+ **Common scenarios:**
208
+
209
+ | Scenario | Config |
210
+ |----------|--------|
211
+ | Subscription service (GitHub Copilot, Cursor) | `{ "input": 0, "output": 0 }` |
212
+ | Free/local model | `{ "input": 0, "output": 0 }` |
213
+ | Custom API with known pricing | Look up provider's pricing page |
214
+
186
215
  ### Pricing Override
187
216
 
188
217
  Pricing is resolved in this order (first match wins):
@@ -207,7 +236,7 @@ If you're using GitHub Copilot or other subscription-based services, set their c
207
236
 
208
237
  #### Example: Custom model pricing
209
238
 
210
- Override or add pricing for specific models:
239
+ Override or add pricing for specific models (prices in USD per 1M tokens):
211
240
 
212
241
  ```json
213
242
  {
@@ -407,19 +407,47 @@ function cmdConfig(action) {
407
407
  for (const model of unknownModels) {
408
408
  exampleConfig.models[model] = { input: 1, output: 4 };
409
409
  }
410
+ // Print explanation first
411
+ console.log(`
412
+ Pricing Configuration Guide
413
+ ══════════════════════════════════════════════════════════════════
414
+
415
+ All prices are in USD per 1 MILLION tokens.
416
+
417
+ Fields:
418
+ input Cost for input/prompt tokens sent to the model
419
+ output Cost for output/completion tokens from the model
420
+ cacheRead Cost for cached input tokens (optional, usually cheaper)
421
+ cacheWrite Cost for cache write tokens (optional)
422
+
423
+ Examples:
424
+ { "input": 15, "output": 75 } = $15 per 1M input, $75 per 1M output
425
+ { "input": 0, "output": 0 } = Free (subscription or local model)
426
+
427
+ Common scenarios:
428
+ - GitHub Copilot, Cursor, etc. → Set to 0 (subscription-based)
429
+ - Local/self-hosted models → Set to 0
430
+ - Direct API usage → Look up provider's pricing page
431
+
432
+ Where to find pricing:
433
+ - Anthropic: https://www.anthropic.com/pricing
434
+ - OpenAI: https://openai.com/pricing
435
+ - DeepSeek: https://platform.deepseek.com/api-docs/pricing
436
+ - Google: https://ai.google.dev/pricing
437
+ - Or run: opencode-tokens pricing
438
+
439
+ ────────────────────────────────────────────────────────────────
440
+ Example config based on your usage:
441
+ `);
442
+ console.log(JSON.stringify(exampleConfig, null, 2));
410
443
  if (action === "generate") {
411
444
  const json = JSON.stringify(exampleConfig, null, 2);
412
445
  writeFileSync(CONFIG_FILE, json);
413
- console.log(`\n Config file generated: ${CONFIG_FILE}\n`);
414
- console.log(json);
415
- console.log();
416
- }
417
- else {
418
446
  console.log(`
419
- Example config based on your usage:
420
- ────────────────────────────────────────────────────────────────
447
+ Config file created: ${CONFIG_FILE}
421
448
  `);
422
- console.log(JSON.stringify(exampleConfig, null, 2));
449
+ }
450
+ else {
423
451
  console.log(`
424
452
  To create this config file, run:
425
453
  opencode-tokens config generate
@@ -444,8 +472,8 @@ function cmdConfig(action) {
444
472
  console.log();
445
473
  }
446
474
  console.log(` Commands:`);
447
- console.log(` opencode-tokens config init Show example config based on your usage`);
448
- console.log(` opencode-tokens config generate Create config file with example`);
475
+ console.log(` opencode-tokens config init Show example config with explanation`);
476
+ console.log(` opencode-tokens config generate Create config file`);
449
477
  console.log();
450
478
  }
451
479
  function cmdHelp() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-token-tracker",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Real-time token usage and cost tracking plugin for OpenCode with Toast notifications and CLI stats",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",