mirror of
https://github.com/coalaura/whiskr.git
synced 2025-12-02 20:22:52 +00:00
show image pricing too
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
|||||||
type ModelPricing struct {
|
type ModelPricing struct {
|
||||||
Input float64 `json:"input"`
|
Input float64 `json:"input"`
|
||||||
Output float64 `json:"output"`
|
Output float64 `json:"output"`
|
||||||
|
Image float64 `json:"image,omitzero"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Model struct {
|
type Model struct {
|
||||||
@@ -99,6 +100,7 @@ func LoadModels(initial bool) error {
|
|||||||
|
|
||||||
input, _ := strconv.ParseFloat(model.Pricing.Prompt, 64)
|
input, _ := strconv.ParseFloat(model.Pricing.Prompt, 64)
|
||||||
output, _ := strconv.ParseFloat(model.Pricing.Completion, 64)
|
output, _ := strconv.ParseFloat(model.Pricing.Completion, 64)
|
||||||
|
image, _ := strconv.ParseFloat(model.Pricing.Image, 64)
|
||||||
|
|
||||||
m := &Model{
|
m := &Model{
|
||||||
ID: model.ID,
|
ID: model.ID,
|
||||||
@@ -109,6 +111,7 @@ func LoadModels(initial bool) error {
|
|||||||
Pricing: ModelPricing{
|
Pricing: ModelPricing{
|
||||||
Input: input * 1000000,
|
Input: input * 1000000,
|
||||||
Output: output * 1000000,
|
Output: output * 1000000,
|
||||||
|
Image: image,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1456,10 +1456,13 @@
|
|||||||
model.name,
|
model.name,
|
||||||
separator,
|
separator,
|
||||||
`Created:\t\t${formatTimestamp(model.created)}`,
|
`Created:\t\t${formatTimestamp(model.created)}`,
|
||||||
`Pricing/1M:\t$${fixed(model.pricing.input, 2)} In | $${fixed(model.pricing.output, 2)} Out`,
|
`Pricing/1M:\t${formatMoney(model.pricing.input)} In | ${formatMoney(model.pricing.output)} Out`,
|
||||||
|
model.pricing.image ? `Images:\t\t${formatMoney(model.pricing.image)} each` : null,
|
||||||
separator,
|
separator,
|
||||||
stripMarkdown(model.description),
|
stripMarkdown(model.description),
|
||||||
].join("\n");
|
]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join("\n");
|
||||||
|
|
||||||
el.value = model.id;
|
el.value = model.id;
|
||||||
el.textContent = model.name;
|
el.textContent = model.name;
|
||||||
|
|||||||
Reference in New Issue
Block a user