Skip to content

Add MiniMax-M3 model pricing to the cost registry - #217

Open
octo-patch wants to merge 1 commit into
Piebald-AI:mainfrom
octo-patch:octo/20260729-model-add-recvq8Bjx9wmgs
Open

Add MiniMax-M3 model pricing to the cost registry#217
octo-patch wants to merge 1 commit into
Piebald-AI:mainfrom
octo-patch:octo/20260729-model-add-recvq8Bjx9wmgs

Conversation

@octo-patch

@octo-patch octo-patch commented Jul 29, 2026

Copy link
Copy Markdown

Reason: Add the MiniMax-M3 model with its current input, output, and cache-read pricing to the built-in cost registry.

Adds the minimax-m3 model entry to src/models.rs alongside the existing MiniMax models. MiniMax-M3 is priced at $0.60 per 1M input tokens, $2.40 per 1M output tokens, and $0.12 per 1M cache-read tokens (no cache-write pricing). It is registered using the flat cached-input pricing variant and a self-resolving alias is added for the canonical name.

Checks run:

  • cargo check (clean)
  • cargo test --bin splitrail models:: (36 passed, 0 failed)
  • cargo fmt --check (clean)

Summary by CodeRabbit

  • New Features

    • Added support for the Minimax M3 model, including standard and cached-input pricing.
  • Tests

    • Added pricing coverage to verify the Minimax M3 model configuration.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds the built-in minimax-m3 model with input, output, and cached-input pricing, registers its alias, and extends pricing tests for the new model.

Changes

MiniMax M3 registration

Layer / File(s) Summary
Pricing registry, alias, and validation
src/models.rs
Registers minimax-m3 with pricing metadata, maps its alias, and asserts expected input, output, and cached-input costs.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: mike1858, jimyag

Poem

I’m a rabbit with a model to add,
With cached hops and prices clad.
An alias points the way,
Tests keep costs at bay—
MiniMax M3 makes the burrow glad!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding MiniMax-M3 pricing to the cost registry.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/models.rs`:
- Around line 1714-1725: The MiniMax M3 registration currently uses flat pricing
instead of the required token-tiered rates. Update the “minimax-m3” entry to use
PricingStructure::Tiered with a 512_000 threshold, lower-tier
input/output/cached-input rates of 0.30/1.20/0.06, and retain 0.60/2.40/0.12 for
the upper tier; also update the 1M-token assertions in src/models.rs:3494-3496
to reflect the upper-tier pricing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d2f9db64-dd6e-418e-b8c2-86a4fc5a1996

📥 Commits

Reviewing files that changed from the base of the PR and between 9de0187 and ce30ed5.

📒 Files selected for processing (1)
  • src/models.rs

Comment thread src/models.rs
Comment on lines +1714 to +1725
// Source: https://platform.minimax.io/docs/api-reference/anthropic-api-compatible-cache
add_model!(
"minimax-m3",
PricingStructure::Flat {
input_per_1m: 0.60,
output_per_1m: 2.40
},
CachingSupport::OpenAI {
cached_input_per_1m: 0.12
},
false
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg '(^|/)src/models\.rs$|Cargo\.toml$' || true

echo "== relevant model registration context =="
if [ -f src/models.rs ]; then
  sed -n '1660,1750p' src/models.rs
fi

echo "== relevant tests context =="
if [ -f src/models.rs ]; then
  sed -n '3450,3530p' src/models.rs
fi

echo "== pricing structs/usages =="
rg -n "PricingStructure|struct PricingStructure|Flat|Tiered|minimax-m3|add_model" src/models.rs | head -200

Repository: Piebald-AI/splitrail

Length of output: 12301


🌐 Web query:

MiniMax M3 API pricing 512K 1M tokens flat pricing

💡 Result:

MiniMax M3 pricing is not flat; it is tiered based on the input token count per request [1][2]. Under the "Pay as You Go" API billing model, MiniMax-M3 pricing is structured as follows (with current permanent 50% discounts applied): [1][2] Standard Tier Pricing (per 1 million tokens): - Input (≤ 512K tokens): $0.30 [1][3][2] - Input (> 512K tokens): $0.60 [1][2] - Output (≤ 512K tokens): $1.20 [1][3][2] - Output (> 512K tokens): $2.40 [1][2] - Prompt Caching Read (≤ 512K tokens): $0.06 [1][2] - Prompt Caching Read (> 512K tokens): $0.12 [1][2] For "Priority" tier service, which provides faster response times and improved reliability, rates are 1.5x the standard tier pricing [1][2]. Note that MiniMax M3 supports a 1M token context window [4][5], but requests exceeding the 512K input token threshold trigger the higher rate for the entire request [6]. MiniMax also offers "Token Plan" subscription options for individuals and teams, which provide monthly usage quotas rather than standard per-token billing [7][8][9].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== pricing structs =="
sed -n '1,80p' src/models.rs

echo "== validation and calculate_* implementations =="
sed -n '150,240p' src/models.rs
sed -n '240,420p' src/models.rs

echo "== tier examples in model registration =="
sed -n '660,700p' src/models.rs
sed -n '730,770p' src/models.rs
sed -n '1230,1255p' src/models.rs

echo "== deterministic price calculation probe for MiniMax M3 current shape =="
python3 - <<'PY'
# Read relevant model/calculation definitions from src/models.rs without executing repo code.
with open('src/models.rs') as f:
    s = f.read()

checks = {
    "minimax_m3_flat_registration": 'add_model!(\n        "minimax-m3",\n        PricingStructure::Flat' in s,
    "tiered_pricing_struct_exists": "pub struct TieredPricing" in s,
    "tiered_variants_and_threshold_fields": all(x in s for x in ["pub struct TieredPricing", "threshold_1: usize", "rate_1_per_1m", "rate_2_per_1m", "rate_3_per_1m"]),
    "calculate_input_cost_tier_branch": 'PricingStructure::Tiered(tiered)' in s and 'threshold_1' in s.split('fn calculate_input_cost')[1].rsplit('\n}',1)[0] if 'fn calculate_input_cost' in s else False,
}
for k,v in checks.items():
    print(f"{k}={v}")

start = s.index('pub enum PricingStructure')
end = s.find('\n}', start) + 2
print("\n-- PricingStructure enum --")
print(s[start:end])
PY

Repository: Piebald-AI/splitrail

Length of output: 15472


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate calculate functions =="
rg -n "fn calculate_(input|output|cache)_cost|fn calculate.*with.*tier" src/models.rs

echo "== calculate function body slices =="
# Capture from each function definition to the next function/impl boundary.
while IFS=: read -r -n 1 line char; do
  line=${line%$'\r'}
  if [[ "$char" == "\n" ]] && [[ "$line" =~ ^fn\ calculate ]]; then
    start=$line
  fi
done < /dev/null
# Simpler: sed from known function names found above.
rg -n -A80 "^fn calculate_input_cost|^fn calculate_output_cost|^fn calculate_cache_cost" src/models.rs | sed -n '1,220p'

echo "== full calculate_* blocks via awk =="
python3 - <<'PY'
from pathlib import Path
p=Path('src/models.rs')
text=p.read_text()
for name in ['calculate_input_cost','calculate_output_cost','calculate_cache_cost']:
    idx=text.find(f'fn {name}(')
    if idx==-1: continue
    brace=text.find('{', idx)
    depth=0
    end=len(text)
    for i,char in enumerate(text[brace:], brace):
        if char=='{': depth+=1
        elif char=='}':
            depth-=1
            if depth==0:
                end=i+1
                break
    print(f"\n--- {name} lines {text[:idx+1].count(chr(10))+1}-{text[:end].count(chr(10))+1} ---")
    print(text[idx:end])
PY

echo "== tiered cache helper functions references =="
rg -n "TieredCaching|bracket_pricing|calculate_cache_cost_for" src/models.rs

Repository: Piebald-AI/splitrail

Length of output: 739


🌐 Web query:

site:platform.minimax.io/docs MiniMax M3 prompt caching rate over 512k tokens

💡 Result:

For the MiniMax-M3 model, prompt caching is available with differentiated pricing based on the input token threshold of 512k [1][2]. When input tokens exceed 512k, the pricing for input, output, and prompt caching read tokens doubles compared to the standard rate for requests with 512k tokens or fewer [2]. As of July 2026, the specific Pay-As-You-Go pricing for the MiniMax-M3 standard service tier is as follows [2]: - For requests with ≤ 512k input tokens: - Input: $0.30 per 1M tokens - Output: $1.20 per 1M tokens - Prompt Caching Read: $0.06 per 1M tokens - For requests with > 512k input tokens: - Input: $0.60 per 1M tokens - Output: $2.40 per 1M tokens - Prompt Caching Read: $0.12 per 1M tokens If you choose the priority service tier, the pricing is 1.5 times these standard rates [2]. Prompt caching applies to API calls with 512 or more input tokens and uses prefix matching for context [1]. You can monitor your usage through the API response, which includes fields for cache hit tokens [3]. For the most accurate and up-to-date pricing, always refer to the official MiniMax Pay-As-You-Go pricing page [2].

Citations:


Use tiered pricing for MiniMax M3. The current registration hardcodes the >512K rates for all 1M-token and lower requests, so it undercharges inputs where MiniMax M3 is billed at $0.30/$1.20/$0.06 at or below 512K and $0.60/$2.40/$0.12 above. Use PricingStructure::Tiered with a 512_000 threshold, default lower tier rates, and the current upper-tier rates, then update the 1M-token assertions.

📍 Affects 1 file
  • src/models.rs#L1714-L1725 (this comment)
  • src/models.rs#L3494-L3496
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/models.rs` around lines 1714 - 1725, The MiniMax M3 registration
currently uses flat pricing instead of the required token-tiered rates. Update
the “minimax-m3” entry to use PricingStructure::Tiered with a 512_000 threshold,
lower-tier input/output/cached-input rates of 0.30/1.20/0.06, and retain
0.60/2.40/0.12 for the upper tier; also update the 1M-token assertions in
src/models.rs:3494-3496 to reflect the upper-tier pricing.

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