mohdel 1.3.1 → 1.3.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/cli/model.js +16 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mohdel",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Christophe Le Bars",
@@ -135,7 +135,7 @@
135
135
  "@opentelemetry/exporter-trace-otlp-grpc": "^0.222.0",
136
136
  "@opentelemetry/sdk-node": "^0.222.0",
137
137
  "chalk": "^6.0.0",
138
- "mohdel-thin-gate-linux-x64-gnu": "1.3.1"
138
+ "mohdel-thin-gate-linux-x64-gnu": "1.3.2"
139
139
  },
140
140
  "dependencies": {
141
141
  "@anthropic-ai/sdk": "^0.125.0",
package/src/cli/model.js CHANGED
@@ -759,9 +759,23 @@ function resolvePrice (p) {
759
759
  return 0
760
760
  }
761
761
 
762
+ // Per-1M-token pricing is the pair; the other kinds bill on one dimension of
763
+ // their own, and reading only the pair prints a priced model as free.
764
+ const SINGLE_DIMENSION_PRICES = [
765
+ ['embeddingPrice', ''],
766
+ ['imagePrice', '/image'],
767
+ ['transcriptionPrice', '/min']
768
+ ]
769
+
762
770
  function formatPrice (info) {
763
771
  const inp = resolvePrice(info.inputPrice)
764
772
  const out = resolvePrice(info.outputPrice)
765
- if (!inp && !out) return meta('free')
766
- return price(`$${inp}`) + meta('/') + price(`$${out}`)
773
+ if (inp || out) return price(`$${inp}`) + meta('/') + price(`$${out}`)
774
+
775
+ for (const [field, unit] of SINGLE_DIMENSION_PRICES) {
776
+ const p = resolvePrice(info[field])
777
+ if (p) return price(`$${p}`) + meta(unit)
778
+ }
779
+
780
+ return meta('free')
767
781
  }