Skip to content

execution_info cost tracking broken for small amounts + missing webpage content tokens #1007

@gouthamindukuri

Description

@gouthamindukuri

Describe the bug

execution_info shows total_cost_USD: 0.0 for OpenRouter calls that cost small amounts. Two issues:

  1. Rounding problem: Small costs <$0.0 get rounded down to 0.0 instead of showing the actual amount
  2. Missing tokens: prompt_tokens only counts the user prompt, completely ignores the webpage content that gets fed to the LLM

To Reproduce

Using OpenRouter with gpt-4.1 model, for a decent size webpage scraping call, the exec info shows:

[
  {
    "node_name": "GenerateAnswer",
    "total_tokens": 213,
    "prompt_tokens": 193,
    "completion_tokens": 20,
    "successful_requests": 1,
    "total_cost_USD": 0.0,
    "exec_time": 1.89
  },
  {
    "node_name": "TOTAL RESULT", 
    "total_tokens": 213,
    "prompt_tokens": 193,
    "completion_tokens": 20,
    "successful_requests": 1,
    "total_cost_USD": 0.0,
    "exec_time": 8.98
  }
]

But checking OpenRouter shows I actually got charged (even if small amounts like $0.007-0.01 per call).

Expected behavior

  • total_cost_USD should show the actual cost, not 0.0
  • prompt_tokens should include webpage content tokens, not just the user prompt (193 tokens seems way too low for a full webpage + prompt)

Additional context

Input token usage issue is actaully for manual cost tracking as a fallback which is now impossible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions