Skip to content

OpenRouter free-tier models report incorrect costs #463

Description

@Sanjeev-S

Bug

OpenRouter free-tier models report GPT-4o default pricing (~$2.50/$10.00 per 1M tokens) instead of $0 in IronClaw UI.

Reproduction

Set .env:

LLM_BACKEND=openai_compatible
LLM_BASE_URL=https://openrouter.ai/api/v1
LLM_API_KEY=sk-or-...
LLM_MODEL=openrouter/free

Send any message. Logs show:

DEBUG LLM call used 7749 input + 180 output tokens ($0.021172)

Root cause

src/llm/costs.rs model_cost() strips the provider prefix via rsplit_once('/'), leaving free. This doesn't match any known model or the is_local_model() heuristic, so it falls back to default_cost() (GPT-4o pricing).

Same issue for any OpenRouter model with the :free suffix (e.g. stepfun/step-3.5-flash:free).

Expected behavior

All models with the :free suffix and the openrouter/free router should report zero cost.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions