Skip to content

[Bug]: minimax-portal OAuth usage tracker reports "0% left" despite full MiniMax balance — blocks Discord but CLI works #52335

Description

@IVY-AI-gif

Environment

  • OpenClaw Version: 2026.3.13 (CLI) / 2026.3.11 (Gateway — version mismatch detected by openclaw doctor)
  • OS: OpenCloudOS (Tencent Cloud Singapore, Linux aarch64-compatible VM)
  • Node: v22.22.0 (via nvm)
  • Channel: Discord (guild channel, @LusterClaw Bot)
  • Provider: minimax-portal (OAuth mode, api: "anthropic-messages")
  • Model: minimax-portal/MiniMax-M2.5 (default)
  • baseUrl: https://api.minimaxi.com/anthropic

Problem Summary

OpenClaw's internal usage tracker for the minimax-portal provider persistently reports "0% left" on the 5-hour rolling window, which causes the Discord channel to refuse requests. Meanwhile:

  1. CLI openclaw agent works perfectly — returns correct responses with valid token usage
  2. Browser/web chat works — same model, same API key
  3. MiniMax official website shows the account balance is nearly full and unused
  4. Discord fails — reports insufficient balance / quota exhausted

This means OpenClaw's usage tracking is incorrectly calculating that the MiniMax Portal quota is exhausted when it isn't.

Evidence from Server Logs

1. Health check consistently shows "0% left"

Every openclaw health run and every heartbeat log entry shows:

Usage:
  MiniMax
    5h: 0% left · resets 1h Xm

This has been persistent across multiple checks on 2026-03-22.

2. CLI agent test succeeds with correct token usage

openclaw agent --agent main --message "ping" --json

Returns successfully:

{
  "status": "ok",
  "result": {
    "payloads": [{ "text": "pong 🏓" }],
    "meta": {
      "agentMeta": {
        "provider": "minimax-portal",
        "model": "MiniMax-M2.5",
        "lastCallUsage": {
          "input": 82,
          "output": 35,
          "cacheRead": 0,
          "cacheWrite": 17126,
          "total": 17243
        }
      }
    }
  }
}

Token usage is non-zero and correct, yet the usage tracker still shows 0%.

3. Discord in disconnect/reconnect loop

The health-monitor keeps detecting Discord as disconnected every ~10 minutes and restarting:

[discord:default] health-monitor: restarting (reason: disconnected)
[default] starting provider (@LusterClaw Bot)
logged in to discord as 1481841511573491722 (LusterClaw Bot)
[discord:default] health-monitor: restarting (reason: disconnected)  ← 10 min later

Last successful Discord message was ~6 days ago (agent:main:discord:channel:... (9023m ago)).

4. Gateway version mismatch

openclaw doctor reports the gateway service entrypoint doesn't match the current install:

This version mismatch may contribute to the issue.

Reproduction Steps

  1. Configure minimax-portal provider with OAuth on a self-hosted OpenClaw server
  2. Set minimax-portal/MiniMax-M2.5 as default model
  3. Enable Discord channel
  4. Send messages via Discord — observe failure due to "0% left" usage
  5. Run openclaw agent --message "ping" --json — observe it works fine
  6. Run openclaw health — observe "5h: 0% left" for MiniMax
  7. Check actual MiniMax account balance on minimaxi.com — balance is full

Expected Behavior

  • The usage tracker should accurately reflect actual MiniMax Portal usage
  • If CLI calls succeed with valid token counts, the usage tracker should not report "0% left"
  • Discord channel should work the same as CLI and browser channels

Actual Behavior

  • Usage tracker permanently stuck at "0% left" for minimax-portal
  • Discord refuses requests based on this incorrect usage data
  • CLI bypasses usage check and works fine
  • Browser/web chat also works

Possibly Related Issues

Additional Context

The minimax-portal provider config has cost set to all zeros:

{
  "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
}

This zero-cost configuration may interact badly with the usage percentage calculation (e.g., division by zero or treating zero-cost as "fully consumed"). The separate minimax provider (API key mode) has non-zero costs configured and may not be affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions