Skip to content

fix(tui): price Xiaomi MiMo primary models#2750

Draft
cyq1017 wants to merge 1 commit into
Hmbown:mainfrom
cyq1017:codex/2731-mimo-pricing
Draft

fix(tui): price Xiaomi MiMo primary models#2750
cyq1017 wants to merge 1 commit into
Hmbown:mainfrom
cyq1017:codex/2731-mimo-pricing

Conversation

@cyq1017
Copy link
Copy Markdown
Contributor

@cyq1017 cyq1017 commented Jun 4, 2026

Addresses #2731.

Summary

  • Add pricing lookup support for mimo-v2.5-pro and xiaomi/mimo-v2.5-pro using the same rates as DeepSeek V4-Pro.
  • Add pricing lookup support for mimo-v2.5 and xiaomi/mimo-v2.5 using the same rates as DeepSeek V4-Flash.
  • Reuse shared DeepSeek V4 pricing helpers so the MiMo aliases stay aligned with the existing DeepSeek rates.

Verification

  • cargo test -p codewhale-tui xiaomi_mimo_primary_models_use_matching_deepseek_v4_rates -- --nocapture
  • cargo test -p codewhale-tui pricing::tests -- --nocapture
  • cargo check -p codewhale-tui
  • rustfmt --edition 2024 --check crates/tui/src/pricing.rs
  • git diff --check

Local macOS verification used Command Line Tools clang because the full Xcode toolchain lookup hangs in this environment.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cyq1017 has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Thanks @cyq1017 for taking the time to contribute.

This repository is currently observing a maintainer-managed contribution gate in dry-run mode, so this pull request is staying open. When enforcement is enabled, pull requests from contributors who are not listed in .github/APPROVED_CONTRIBUTORS will be closed automatically.

Please read CONTRIBUTING.md for the expected contribution shape. A maintainer can grant PR access by commenting /lgtm on a pull request.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the pricing logic in crates/tui/src/pricing.rs to map Xiaomi Mimo models to DeepSeek V4 pricing rates, extracting the pricing structures into dedicated helper functions and adding corresponding unit tests. The reviewer suggested simplifying the control flow and making it more idiomatic by combining the exact string matches and the substring checks into a single match expression with guards.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread crates/tui/src/pricing.rs
Comment on lines +120 to +136
match lower.as_str() {
"xiaomi/mimo-v2.5-pro" | "mimo-v2.5-pro" => return Some(deepseek_v4_pro_pricing()),
"xiaomi/mimo-v2.5" | "mimo-v2.5" => return Some(deepseek_v4_flash_pricing()),
_ => {}
}
if lower.contains("v4-pro") || lower.contains("v4pro") {
// DeepSeek's pricing page says the V4-Pro promotional 75% discount
// becomes the official one-quarter base price after 2026-05-31 15:59
// UTC. Keep using the adjusted rate after that cutoff (#2489).
Some(ModelPricing {
usd: CurrencyPricing {
input_cache_hit_per_million: 0.003625,
input_cache_miss_per_million: 0.435,
output_per_million: 0.87,
},
cny: CurrencyPricing {
input_cache_hit_per_million: 0.025,
input_cache_miss_per_million: 3.0,
output_per_million: 6.0,
},
})
if lower.contains("deepseek") {
if lower.contains("v4-pro") || lower.contains("v4pro") {
// DeepSeek's pricing page says the V4-Pro promotional 75% discount
// becomes the official one-quarter base price after 2026-05-31 15:59
// UTC. Keep using the adjusted rate after that cutoff (#2489).
Some(deepseek_v4_pro_pricing())
} else {
Some(deepseek_v4_flash_pricing())
}
} else {
// deepseek-v4-flash pricing.
Some(ModelPricing {
usd: CurrencyPricing {
input_cache_hit_per_million: 0.0028,
input_cache_miss_per_million: 0.14,
output_per_million: 0.28,
},
cny: CurrencyPricing {
input_cache_hit_per_million: 0.02,
input_cache_miss_per_million: 1.0,
output_per_million: 2.0,
},
})
None
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The control flow can be simplified and made more idiomatic by combining the exact match and the contains checks into a single match expression. This avoids the need for explicit return statements and makes the function's structure cleaner.

    match lower.as_str() {
        "xiaomi/mimo-v2.5-pro" | "mimo-v2.5-pro" => Some(deepseek_v4_pro_pricing()),
        "xiaomi/mimo-v2.5" | "mimo-v2.5" => Some(deepseek_v4_flash_pricing()),
        _ if lower.contains("deepseek") => {
            if lower.contains("v4-pro") || lower.contains("v4pro") {
                // DeepSeek's pricing page says the V4-Pro promotional 75% discount
                // becomes the official one-quarter base price after 2026-05-31 15:59
                // UTC. Keep using the adjusted rate after that cutoff (#2489).
                Some(deepseek_v4_pro_pricing())
            } else {
                Some(deepseek_v4_flash_pricing())
            }
        }
        _ => None,
    }

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant