Skip to content

feat(azure_speech): price fast transcription by the enhancedMode model - #48404

Open
anilkumara9 wants to merge 1 commit into
BerriAI:mainfrom
anilkumara9:litellm_azure_speech_mai_transcribe_pricing_48387
Open

anilkumara9 wants to merge 1 commit into
BerriAI:mainfrom
anilkumara9:litellm_azure_speech_mai_transcribe_pricing_48387

Conversation

@anilkumara9

Copy link
Copy Markdown

Fast transcription calls that run a MAI-Transcribe model through the Azure Speech pass-through are now logged under the model that actually ran, and priced at that model's rate instead of the standard speech rate. Calls that do not use enhanced mode log and price exactly as they did before

Details

TLDR

Problem this solves:

  • Fast transcription is always logged as azure_speech/fast-transcription
  • MAI-Transcribe-2 calls are priced at the standard rate
  • Spend logs cannot tell which model ran

How it solves it:

  • Reads enhancedMode.model from the multipart definition
  • Logs the call as azure_speech/
  • Prices from the matching cost map entry
  • Falls back to the standard entry when none matches
  • Adds a cost map entry for MAI-Transcribe-2

User Flow

Before: an operator routes Azure Speech fast transcription through the gateway and their spend logs price a premium model at the standard rate

  1. They send POST https://litellm-domain/azure_speech/speechtotext/transcriptions:transcribe with a multipart definition that enables enhanced mode with MAI-Transcribe-2
  2. Azure transcribes the audio with MAI-Transcribe-2 and returns it with its duration
  3. They open https://litellm-domain/ui/?page=logs and see the call logged as azure_speech/fast-transcription at the standard speech rate

After: the same call is logged under the model that ran, at that model's rate

  1. They send the same POST with the same multipart definition
  2. Azure transcribes the audio with MAI-Transcribe-2 and returns it with its duration
  3. https://litellm-domain/ui/?page=logs shows the call as azure_speech/MAI-Transcribe-2 at the MAI-Transcribe-2 rate of $0.54 per hour of audio

Relevant issues

Fixes #48387

Pre-Submission checklist

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

  • I have added meaningful tests
  • The handful of test files covering my change pass locally
  • My PR passes all required CI/CD checks
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Screenshots / Proof of Fix

The proof below is unit level with a fabricated multipart request, because a live run needs a real Azure Speech resource and its key, which I do not have. A live proxy run is still owed and this section should be replaced with one before review is requested

Before (dddbbaa8)

  1. Run the 6 new tests in tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_azure_speech_passthrough_logging_handler.py with the production change stashed
  2. Observed output: the 3 tests asserting the new model name and per-model price fail, because the handler always logged azure_speech/fast-transcription at the standard rate; the 3 guard tests pass

After (5cdaa90)

  1. Run the same tests with the fix restored
  2. Observed output: all 6 new tests pass
  3. Run pytest on the whole mapped file
  4. Observed output: 48 passed, 1 failed - test_missing_price_entry_still_logs_the_row_at_zero_cost fails identically on clean main in this sandbox and passes in isolation in both trees, so it is pre-existing and unrelated
  5. Direct check against the loaded cost map: 1 hour of MAI-Transcribe-2 = $0.54, standard entry = $1.00

Type

🆕 New Feature

Caveats

Pricing source

  • The Microsoft Learn page linked in the issue gives no price for MAI-Transcribe. The $0.54/hour rate for MAI-Transcribe-2 comes from Microsoft's official Azure Retail Prices API (prices.azure.com), uniform across all 44 region/meter rows, effective 2026-10-01 - the same source the cost map already cites for other Foundry Models entries
  • MAI-Transcribe-1.5 has no published Microsoft price anywhere (the Retail Prices API returns 0 meters for it), so no entry was added for it and nothing was guessed. Calls naming it are logged under their own model name and fall back to the standard rate, ready for an entry the day Microsoft publishes a meter

Low

  • Step 5 of the proposal (custom-pricing override) was left out on purpose: the issue marks it optional, and this logging handler receives no deployment pricing in its inputs
  • Proof above is unit level, a live proxy run against a real Azure Speech resource is still owed
  • The LiteLLM CLA still needs signing by the contributor

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

AI assistance disclosure: this change was prepared with AI assistance. Every line was read against the issue and the surrounding code, the new tests failed on main before the change, and the test results above are from local runs the contributor can walk through. The LiteLLM CLA has not been signed yet and will be signed by the contributor when the PR is opened

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T12:52:44.693972Z
We couldn’t complete this review. Comment @codex review to try again.
5cdaa90 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codspeed

codspeed Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 35 untouched benchmarks


Comparing anilkumara9:litellm_azure_speech_mai_transcribe_pricing_48387 (5cdaa90) with main (72f1ac4)1

Open in CodSpeed

Footnotes

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

@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ndlers/azure_speech_passthrough_logging_handler.py 94.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@CLAassistant

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 sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
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.

[Feature]: Azure Speech pass-through should price fast transcription by enhancedMode.model (MAI-Transcribe-2)

2 participants