Skip to content

[Fix] Add flex and priority pricing for o4-mini-2025-04-16 - #22086

Open
shivamrawat1 wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_flex_resoning_price_cal
Open

[Fix] Add flex and priority pricing for o4-mini-2025-04-16#22086
shivamrawat1 wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_flex_resoning_price_cal

Conversation

@shivamrawat1

@shivamrawat1 shivamrawat1 commented Feb 25, 2026

Copy link
Copy Markdown
Collaborator

Relevant issues

When using o4-mini with service_tier="flex", completion_cost() was returning standard-tier cost instead of flex-tier cost because the cost calculator uses the model name from the API response (o4-mini-2025-04-16), not the one in the request (o4-mini). The o4-mini-2025-04-16 entry in the model cost map did not define flex/priority pricing keys (input_cost_per_token_flex, output_cost_per_token_flex, etc.), so the lookup fell back to standard pricing. The fix was to add these flex and priority pricing keys to o4-mini-2025-04-16 in both model_prices_and_context_window.json and model_prices_and_context_window_backup.json, using the same values as the o4-mini alias, so flex requests are priced correctly.

Pre-Submission checklist

Before:
Screenshot 2026-02-25 at 3 31 57 AM
After:
Screenshot 2026-02-25 at 3 32 05 AM

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🐛 Bug Fix

Changes

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Feb 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Apr 5, 2026 7:58am

Request Review

@greptile-apps

greptile-apps Bot commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds flex and priority token pricing for the dated o4-mini-2025-04-16 model in both pricing maps. It also contains broad CI/workflow and installation-script changes beyond the stated pricing fix.

  • Synchronizes six service-tier pricing fields between the primary and backup model maps.
  • Reorganizes GitHub Actions and CircleCI test workflows.
  • Updates build and installation tooling.

Confidence Score: 4/5

The PR is not yet safe to merge because the previously reported dated-model pricing inconsistency remains unresolved.

Only o4-mini-2025-04-16 receives tier-specific prices; the dated o3 and GPT-4.1-family entries still lack corresponding fields, causing priority or flex cost calculation to fall back to standard rates and under-report spend.

Files Needing Attention: model_prices_and_context_window.json

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds the intended o4-mini dated-model prices, but the previously reported equivalent omissions on other dated entries remain.
litellm/model_prices_and_context_window_backup.json Mirrors the six o4-mini-2025-04-16 tier-pricing additions from the canonical pricing map.
.circleci/config.yml Broadly restructures dependency installation and test-job organization; no eligible new follow-up finding was identified.
scripts/install.sh Adds installation tooling unrelated to the prior pricing thread; no eligible follow-up comment was retained.

Reviews (3): Last reviewed commit: "chore: fixes" | Re-trigger Greptile

@greptile-apps greptile-apps Bot left a comment

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.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 24251 to +24265
"o4-mini-2025-04-16": {
"cache_read_input_token_cost": 2.75e-07,
"cache_read_input_token_cost_flex": 1.375e-07,
"cache_read_input_token_cost_priority": 5e-07,
"input_cost_per_token": 1.1e-06,
"input_cost_per_token_flex": 5.5e-07,
"input_cost_per_token_priority": 2e-06,
"litellm_provider": "openai",
"max_input_tokens": 200000,
"max_output_tokens": 100000,
"max_tokens": 100000,
"mode": "chat",
"output_cost_per_token": 4.4e-06,
"output_cost_per_token_flex": 2.2e-06,
"output_cost_per_token_priority": 8e-06,

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.

Same issue exists in other dated model entries

This fix is correct for o4-mini-2025-04-16, but the same alias-vs-dated inconsistency exists for other models. The following dated entries are missing flex/priority pricing that their non-dated aliases define:

  • o3-2025-04-16 (line 24034) — missing all 6 flex and priority keys that o3 has
  • gpt-4.1-2025-04-14 (line 18681) — missing priority keys that gpt-4.1 has
  • gpt-4.1-mini-2025-04-14 — missing priority keys that gpt-4.1-mini has
  • gpt-4.1-nano-2025-04-14 — missing priority keys that gpt-4.1-nano has

These will exhibit the same bug: completion_cost() returns standard-tier pricing when the API response uses the dated model name with service_tier="flex" or "priority". Consider fixing these in this PR for completeness.

@yuneng-berri
yuneng-berri requested a review from a team April 5, 2026 07:52
@CLAassistant

CLAassistant commented Apr 5, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ yuneng-berri
❌ shivam


shivam seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions Bot added the stale label Jul 9, 2026
@github-actions github-actions Bot closed this Jul 18, 2026
@shivamrawat1 shivamrawat1 reopened this Aug 2, 2026
@shivamrawat1
shivamrawat1 changed the base branch from main to litellm_internal_staging August 2, 2026 01:05
@github-actions github-actions Bot removed the stale label Aug 3, 2026
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.

3 participants