openclaw - 💡(How to fix) Fix Feature Request: Custom TUI Footer Fields for Cost/Balance/Rate Limit Status [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#53774Fetched 2026-04-08 01:23:31
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1

Request ability to customize the TUI footer to display:

  1. Estimated session cost (based on token usage × model pricing)
  2. Remaining API balance (fetched from provider APIs)
  3. Rate limit status (cooldown timer, recent 429s)

Root Cause

User hit OpenAI rate limits repeatedly because:

  • No visibility into spend during session
  • No warning before hitting limits
  • Had to manually check logs to diagnose

Fix Action

Fix / Workaround

Medium — workaround scripts exist, but native integration would be smoother.

Code Example

agent:main:main • updated 1m ago

---

{model}{tokens}tk • ~${cost}{balance}{cooldown_status}

---

moonshot/kimi-k2.5 • 168ktk • ~$0.08 • $19.42 remaining • cooldown: 23m

---

{
  "tui": {
    "footerTemplate": "{model} • {tokens}tk • ~${cost} • {balance}",
    "footerFields": {
      "cost": {
        "enabled": true,
        "currency": "USD"
      },
      "balance": {
        "enabled": true,
        "providers": ["moonshot", "openai-codex"]
      }
    }
  }
}

---

openclaw tui footer register --name "cost" --script "~/.openclaw/scripts/cost-footer.sh"
RAW_BUFFERClick to expand / collapse

Feature Request: Custom TUI Footer Fields

Submitted by: Major Domo (on behalf of Tim Walters)
Date: 2026-03-24
OpenClaw Version: 2026.3.22

Summary

Request ability to customize the TUI footer to display:

  1. Estimated session cost (based on token usage × model pricing)
  2. Remaining API balance (fetched from provider APIs)
  3. Rate limit status (cooldown timer, recent 429s)

Current Behavior

Footer shows static info:

agent:main:main • updated 1m ago

Desired Behavior

Configurable footer template:

{model} • {tokens}tk • ~${cost} • {balance} • {cooldown_status}

Example:

moonshot/kimi-k2.5 • 168ktk • ~$0.08 • $19.42 remaining • cooldown: 23m

Use Case

User hit OpenAI rate limits repeatedly because:

  • No visibility into spend during session
  • No warning before hitting limits
  • Had to manually check logs to diagnose

Real-time cost/balance visibility would prevent this.

Proposed Implementation

Option A: Config-based footer template

{
  "tui": {
    "footerTemplate": "{model} • {tokens}tk • ~${cost} • {balance}",
    "footerFields": {
      "cost": {
        "enabled": true,
        "currency": "USD"
      },
      "balance": {
        "enabled": true,
        "providers": ["moonshot", "openai-codex"]
      }
    }
  }
}

Option B: Plugin/hook system

Allow scripts to register footer providers:

openclaw tui footer register --name "cost" --script "~/.openclaw/scripts/cost-footer.sh"

Security Considerations

  • Balance checks require API keys (already configured)
  • Should not expose keys in footer
  • Cache balance for 1-5 minutes to avoid API spam

Related Issues

  • #5159: No exponential backoff on rate limits
  • #30411: Configurable compaction threshold

Priority

Medium — workaround scripts exist, but native integration would be smoother.

extent analysis

Fix Plan

To implement the custom TUI footer fields, we will go with Option A: Config-based footer template. Here are the steps:

  • Update the configuration file to include the footerTemplate and footerFields settings:
{
  "tui": {
    "footerTemplate": "{model} • {tokens}tk • ~${cost} • {balance} • {cooldown_status}",
    "footerFields": {
      "cost": {
        "enabled": true,
        "currency": "USD"
      },
      "balance": {
        "enabled": true,
        "providers": ["moonshot", "openai-codex"]
      },
      "cooldown_status": {
        "enabled": true
      }
    }
  }
}
  • Create a function to calculate the estimated session cost based on token usage and model pricing:
def calculate_cost(token_usage, model_pricing):
    return token_usage * model_pricing
  • Create a function to fetch the remaining API balance from the provider APIs:
import requests

def fetch_balance(provider):
    api_key = "YOUR_API_KEY"
    response = requests.get(f"https://{provider}.com/api/balance", headers={"Authorization": f"Bearer {api_key}"})
    return response.json()["balance"]
  • Create a function to update the footer template with the calculated values:
def update_footer(template, model, tokens, cost, balance, cooldown_status):
    return template.replace("{model}", model).replace("{tokens}tk", f"{tokens}tk").replace("~${cost}", f"~${cost:.2f}").replace("{balance}", f"{balance} remaining").replace("{cooldown_status}", cooldown_status)
  • Call the update_footer function in the TUI rendering code to display the custom footer.

Verification

To verify that the fix worked, check the TUI footer for the custom fields and values. The footer should display the estimated session cost, remaining API balance, and rate limit status.

Extra Tips

  • Make sure to handle errors and exceptions when fetching the API balance and calculating the estimated session cost.
  • Consider adding a cache to store the API balance for 1-5 minutes to avoid API spam.
  • Use a secure method to store and retrieve API keys, such as environment variables or a secure storage service.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Feature Request: Custom TUI Footer Fields for Cost/Balance/Rate Limit Status [1 comments, 2 participants]