Skip to content

feat(cost-map): add Cloudflare Workers AI whisper transcription models - #38384

Closed
mubashir1osmani wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
mubashir1osmani:litellm_add_cloudflare_whisper_models
Closed

feat(cost-map): add Cloudflare Workers AI whisper transcription models#38384
mubashir1osmani wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
mubashir1osmani:litellm_add_cloudflare_whisper_models

Conversation

@mubashir1osmani

@mubashir1osmani mubashir1osmani commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Cloudflare Workers AI whisper models missing from the cost map
  • Their transcriptions log as $0 spend
  • No mode or pricing shows on /model/info

How it solves it:

  • Add the three whisper models with per-second pricing
  • Prices converted from Cloudflare's published per-audio-minute rates
  • Keep root and bundled cost maps in sync

User Flow

Before: an admin who adds Cloudflare's whisper models to their config sees no pricing or task type for them, so they cannot tell what a transcription will cost

  1. They add cloudflare/@cf/openai/whisper, cloudflare/@cf/openai/whisper-large-v3-turbo and cloudflare/@cf/openai/whisper-tiny-en to their proxy config and restart
  2. They call GET http://localhost:4010/model/info with the master key
  3. Every one of the three comes back with "mode": null, "input_cost_per_second": null and "output_cost_per_second": null, the same shape an unknown model would return

After: the same three models come back with their task type and Cloudflare's published rates

  1. They add the same three models to their proxy config and restart
  2. They call GET http://localhost:4010/model/info with the master key
  3. Each comes back with "mode": "audio_transcription", and input_cost_per_second of 7.5e-06 for whisper and 8.5e-06 for whisper-large-v3-turbo, matching Cloudflare's $0.00045 and $0.00051 per audio minute
  4. whisper-tiny-en comes back at 0.0, since Cloudflare publishes no rate for it while it is in beta

Relevant issues

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • 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 (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Screenshots / Proof of Fix

Shared setup, used for both runs:

model_list:
  - model_name: cf-whisper
    litellm_params:
      model: cloudflare/@cf/openai/whisper
      api_key: os.environ/CLOUDFLARE_API_KEY
  - model_name: cf-whisper-large-v3-turbo
    litellm_params:
      model: cloudflare/@cf/openai/whisper-large-v3-turbo
      api_key: os.environ/CLOUDFLARE_API_KEY
  - model_name: cf-whisper-tiny-en
    litellm_params:
      model: cloudflare/@cf/openai/whisper-tiny-en
      api_key: os.environ/CLOUDFLARE_API_KEY

general_settings:
  master_key: sk-1234

Both runs start the proxy the same way, from the checkout under test:

LITELLM_LOCAL_MODEL_COST_MAP=True python3 -m litellm.proxy.proxy_cli --config /tmp/cf_whisper_config.yaml --port 4010

Before (7bc8099)

  1. Ask the proxy what it knows about the three models
curl -s -H "Authorization: Bearer sk-1234" http://localhost:4010/model/info \
  | python3 -c "
import json,sys
for m in json.load(sys.stdin)['data']:
    if 'whisper' in m['model_name']:
        i = m['model_info']
        print(json.dumps({k: i.get(k) for k in ('mode','input_cost_per_second','output_cost_per_second')} | {'model_name': m['model_name']}))
"
  1. All three report no task type and no price
{"mode": null, "input_cost_per_second": null, "output_cost_per_second": null, "model_name": "cf-whisper"}
{"mode": null, "input_cost_per_second": null, "output_cost_per_second": null, "model_name": "cf-whisper-large-v3-turbo"}
{"mode": null, "input_cost_per_second": null, "output_cost_per_second": null, "model_name": "cf-whisper-tiny-en"}

After (de33cff)

  1. Run the exact same command
curl -s -H "Authorization: Bearer sk-1234" http://localhost:4010/model/info \
  | python3 -c "
import json,sys
for m in json.load(sys.stdin)['data']:
    if 'whisper' in m['model_name']:
        i = m['model_info']
        print(json.dumps({k: i.get(k) for k in ('mode','input_cost_per_second','output_cost_per_second')} | {'model_name': m['model_name']}))
"
  1. Each model now reports its task type and Cloudflare's rate
{"mode": "audio_transcription", "input_cost_per_second": 7.5e-06, "output_cost_per_second": 0.0, "model_name": "cf-whisper"}
{"mode": "audio_transcription", "input_cost_per_second": 8.5e-06, "output_cost_per_second": 0.0, "model_name": "cf-whisper-large-v3-turbo"}
{"mode": "audio_transcription", "input_cost_per_second": 0.0, "output_cost_per_second": 0.0, "model_name": "cf-whisper-tiny-en"}
  1. Confirm the per-second numbers are Cloudflare's per-minute rates divided by 60
python3 -c "print(0.00045/60, 0.00051/60)"
7.5e-06 8.5e-06

Type

🆕 New Feature

Caveats (if any)

Medium

  • Audio sent to these models still fails
    • The cloudflare provider only handles chat today
    • /v1/audio/transcriptions returns "Unmapped provider passed in"
    • Wiring up that route is follow-up work
  • whisper-tiny-en tracks as $0 spend
    • Cloudflare publishes no rate while it is in beta
    • Revisit once they publish one

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

Note

Low Risk
Metadata-only cost-map and test changes; no runtime routing or billing logic is modified in this PR.

Overview
Adds three Cloudflare Workers AI Whisper models to the model cost map (model_prices_and_context_window.json and its backup) so /model/info and spend tracking can treat them as audio_transcription instead of unknown models.

cloudflare/@cf/openai/whisper and whisper-large-v3-turbo get input_cost_per_second derived from Cloudflare’s published per-audio-minute rates (7.5e-06 and 8.5e-06), zero output cost, and supported_endpoints ["/v1/audio/transcriptions"]. whisper-tiny-en is registered the same way but priced at $0 with metadata noting missing public pricing while in beta.

New tests in test_cloudflare_workers_ai_model_metadata.py assert per-second conversion, endpoint/mode metadata, and that root and backup Cloudflare entries stay aligned.

Reviewed by Cursor Bugbot for commit de33cff. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds Cloudflare Workers AI Whisper model metadata to the root and bundled cost maps.

  • Records audio-transcription mode and per-second pricing for Whisper and Whisper Large V3 Turbo.
  • Adds an explicitly unpriced beta entry for Whisper Tiny English.
  • Adds regression coverage for metadata, pricing conversion, and synchronization between both maps.

Confidence Score: 5/5

The metadata-only change appears safe to merge, with the currently unsupported Cloudflare transcription execution path explicitly documented as follow-up work.

The new entries conform to the cost-map schema, resolve through existing model-key normalization, and use per-second fields consistently with the audio cost calculator; no unacknowledged blocking or non-blocking defect remains.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds valid Cloudflare Whisper transcription metadata and correctly converted per-second prices to the primary cost map.
litellm/model_prices_and_context_window_backup.json Mirrors the primary cost-map entries exactly for packaged local-cost-map use.
tests/test_litellm/test_cloudflare_workers_ai_model_metadata.py Verifies model mode, endpoint metadata, pricing conversion, the intentional zero-price beta entry, and root/backup synchronization.

Reviews (1): Last reviewed commit: "feat(cost-map): add Cloudflare Workers A..." | Re-trigger Greptile

@codspeed-hq

codspeed-hq Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing mubashir1osmani:litellm_add_cloudflare_whisper_models (de33cff) with litellm_internal_staging (cdb60af)1

Open in CodSpeed

Footnotes

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

@mubashir1osmani

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit de33cff. Configure here.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Closing as superseded by the rolling registry PR #39170, which carries both priced Whisper models and drops whisper-tiny-en since Cloudflare publishes no price. Thank you

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