Skip to content

fix(pricing): add missing deepseek-v4-flash-0731 entries for fireworks_ai - #36254

Closed
Aeriqu wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
Aeriqu:bugfix/fireworkai-deepseekv4flash0731-pricing
Closed

fix(pricing): add missing deepseek-v4-flash-0731 entries for fireworks_ai#36254
Aeriqu wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
Aeriqu:bugfix/fireworkai-deepseekv4flash0731-pricing

Conversation

@Aeriqu

@Aeriqu Aeriqu commented Aug 8, 2026

Copy link
Copy Markdown

TLDR

Problem this solves:

  • Missing pricing entries for Fireworks AI deepseek-v4-flash-0731
  • Proxy cannot calculate request cost for deepseek-v4-flash-0731

How it solves it:

  • Added deepseek-v4-flash-0731 entries to model cost maps
  • Added unit tests for new Fireworks model pricing

User Flow

Before: a developer sending requests to deepseek-v4-flash-0731 gets 0 cost calculated, so their dashboard logs $0 spend

  1. They send POST https://litellm-domain/v1/chat/completions with "model": "fireworks_ai/accounts/fireworks/models/deepseek-v4-flash-0731"
  2. The completion response returns successfully, but token spend calculation evaluates to 0
  3. They open https://litellm-domain/ui/?page=logs and see the request logged at $0 spend

After: the same request calculates real token spend based on Fireworks serverless rates

  1. They send the same POST https://litellm-domain/v1/chat/completions with "model": "fireworks_ai/accounts/fireworks/models/deepseek-v4-flash-0731"
  2. The completion response returns successfully with calculated token spend using $0.14/1M input and $0.28/1M output rates
  3. They open https://litellm-domain/ui/?page=logs and see the request logged with accurate non-zero spend

Relevant issues

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Pricing source documentation links:

Before (commit 1bafdb3c934fcfdb9a81501755e048a40c0ce81f):

Command run:

python3 -c '
import os
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
import litellm

response = litellm.ModelResponse(
    model="accounts/fireworks/models/deepseek-v4-flash-0731",
    usage=litellm.Usage(prompt_tokens=1000, completion_tokens=500, total_tokens=1500)
)
cost = litellm.completion_cost(completion_response=response, model="fireworks_ai/accounts/fireworks/models/deepseek-v4-flash-0731")
print(f"Model: {response.model}")
print(f"Usage: {response.usage}")
print(f"Calculated Cost: ${cost:.6f}")
'

Output:

Model: accounts/fireworks/models/deepseek-v4-flash-0731
Usage: Usage(completion_tokens=500, prompt_tokens=1000, total_tokens=1500, completion_tokens_details=None, prompt_tokens_details=None)
Calculated Cost: $0.000000

After (commit 35e1820c7dcaeec818a02848f97b303f6fc54d70):

Command run:

python3 -c '
import os
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
import litellm

response = litellm.ModelResponse(
    model="accounts/fireworks/models/deepseek-v4-flash-0731",
    usage=litellm.Usage(prompt_tokens=1000, completion_tokens=500, total_tokens=1500)
)
cost = litellm.completion_cost(completion_response=response, model="fireworks_ai/accounts/fireworks/models/deepseek-v4-flash-0731")
print(f"Model: {response.model}")
print(f"Usage: {response.usage}")
print(f"Calculated Cost: ${cost:.6f}")
'

Output:

Model: accounts/fireworks/models/deepseek-v4-flash-0731
Usage: Usage(completion_tokens=500, prompt_tokens=1000, total_tokens=1500, completion_tokens_details=None, prompt_tokens_details=None)
Calculated Cost: $0.000280

Command run with prompt caching:

python3 -c '
import os
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
import litellm

response = litellm.ModelResponse(
    model="deepseek-v4-flash-0731",
    usage=litellm.Usage(
        prompt_tokens=1000,
        completion_tokens=500,
        total_tokens=1500,
        prompt_tokens_details={"cached_tokens": 800}
    )
)
cost = litellm.completion_cost(completion_response=response, model="fireworks_ai/deepseek-v4-flash-0731")
print(f"Model: {response.model}")
print(f"Usage: {response.usage}")
print(f"Calculated Cost with Prompt Caching: ${cost:.6f}")
'

Output:

Model: deepseek-v4-flash-0731
Usage: Usage(completion_tokens=500, prompt_tokens=1000, total_tokens=1500, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetailsWrapper(audio_tokens=None, cached_tokens=800, text_tokens=None, image_tokens=None, video_tokens=None))
Calculated Cost with Prompt Caching: $0.000190

Type

🐛 Bug Fix

Changes

Added deepseek-v4-flash-0731 entries to model_prices_and_context_window.json, litellm/model_prices_and_context_window_backup.json, and tests/test_litellm/test_utils.py

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds full and short Fireworks AI pricing-map entries for deepseek-v4-flash-0731 so LiteLLM can calculate token spend.

  • Adds identical model metadata to the primary and backup cost maps.
  • Covers input, output, and cached-input token prices alongside context limits and capabilities.
  • Extends local tests to validate the full model path and short-form alias in both maps.

Confidence Score: 5/5

The PR appears safe to merge with no concrete correctness, security, or compatibility issues identified.

The primary and backup maps contain matching entries, and the local tests validate exact pricing, limits, capabilities, and equality between the full and short model names.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds synchronized full- and short-form Fireworks pricing entries with consistent rates, limits, and capability metadata.
litellm/model_prices_and_context_window_backup.json Mirrors the new primary cost-map entries without a detected discrepancy.
tests/test_litellm/test_utils.py Extends existing local parameterized checks to validate the new model metadata and alias equality in both cost maps.

Reviews (1): Last reviewed commit: "fix(pricing): add missing deepseek-v4-fl..." | Re-trigger Greptile

@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing Aeriqu:bugfix/fireworkai-deepseekv4flash0731-pricing (35e1820) with litellm_internal_staging (f05d468)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (b6e3ff6) during the generation of this report, so f05d468 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@mateo-berri

Copy link
Copy Markdown
Contributor

Superseded by #38990: both deepseek-v4-flash-0731 twins now carry the published Fireworks rates with pinned-price and twin-consistency tests.

@mateo-berri mateo-berri closed this Sep 1, 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.

2 participants