summaryrefslogtreecommitdiff
path: root/models/openrouter.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/openrouter.go')
-rw-r--r--models/openrouter.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/models/openrouter.go b/models/openrouter.go
index 50f26b6..6196498 100644
--- a/models/openrouter.go
+++ b/models/openrouter.go
@@ -143,11 +143,14 @@ type ORModels struct {
func (orm *ORModels) ListModels(free bool) []string {
resp := []string{}
- for _, model := range orm.Data {
+ for i := range orm.Data {
+ model := &orm.Data[i] // Take address of element to avoid copying
if free {
- if model.Pricing.Prompt == "0" && model.Pricing.Request == "0" &&
- model.Pricing.Completion == "0" {
- resp = append(resp, model.ID)
+ if model.Pricing.Prompt == "0" && model.Pricing.Completion == "0" {
+ // treat missing request as free
+ if model.Pricing.Request == "" || model.Pricing.Request == "0" {
+ resp = append(resp, model.ID)
+ }
}
} else {
resp = append(resp, model.ID)