Skip to content

Unknown or variable prices are treated as $0, so they pass every cost cap and look free to Jev #7

Description

@TheCoder30ec4

Problem

ModelInfo.from_openrouter turns OpenRouter's variable price ("-1") and missing prices into 0.0. Such a model then:

  • passes any Limits(max_cost_usd=...), including a cap of $0
  • is described to Jev as $0.00/M, so it looks like the cheapest choice

Live examples today: openrouter/auto, openrouter/fusion, openrouter/pareto-code (variable), plus models priced per request or per output type rather than per token.

Reproduce

from model_router import ModelInfo
m = ModelInfo.from_openrouter({"id": "x/y", "context_length": 100000,
                               "pricing": {"prompt": "-1", "completion": "-1"}})
m.cost(10_000, 1_000)  # 0.0

Suggested fix

  • Store unknown prices as None instead of 0.0
  • ModelInfo.cost() returns None when a price is unknown
  • Router._reject_reason: when max_cost_usd is set, reject models with an unknown cost ("price unknown")
  • jev._describe: print price unknown instead of $0.00

Done when

  • A variable-price model is rejected under a cost cap and never shown as $0
  • Tests in tests/test_models.py and tests/test_router.py

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: catalogLive model list, prices and provider filteringarea: routingRouter, limits and the Jev requestbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions