litellm/tests/unit/llms/dashscope
zoveki bbc68e21f9
feat(dashscope): add image edits and text-to-speech (#48998)
* feat(dashscope): add image edits and text-to-speech

* fix(dashscope): bill reported speech characters and input images, follow the chat region for edits, keep the call timeout on the audio download

* fix(dashscope): bill deployment image prices as main does and route edits to the host speech uses

A deployment that sets its own input_cost_per_image, output_cost_per_image or input_cost_per_pixel bills through the default image calculator again, so an override is never read as a per-input-image price and pixel pricing on qwen-image-3.0-pro no longer raises.

Edits now resolve the caller's api_base or DASHSCOPE_API_BASE through the same API-root helper speech uses, on any host, with DASHSCOPE_API_BASE_IMAGE still winning. An image response whose usage is null or not an object keeps its images instead of raising.

* fix(images): bill a deployment's own prices on image edits through the proxy

The proxy builds the logging object before the router picks a deployment, so image_edit never handed the deployment's price fields to its cost calculation and billed the cost-map price instead. Pass the custom pricing params with the pre-call update, as the Responses API does.

* fix(images): bill per-pixel image prices at a DashScope W*H size

DashScope's mapped size reads 1328*1328, which the cost size reader rejected, so a deployment's input_cost_per_pixel billed every DashScope generation or edit at the 1024x1024 default.

* fix(dashscope): bill image prices by their meaning, report the rendered size, prefer the deployment edit base, fetch audio over https

* fix(dashscope): read the rendered image size from output_width and output_height

* test(images): bill a fal edit at its deployment's own image price

* fix(dashscope): keep the qwen-image-3.0 input-image fee out of the shared cost map row

Released proxies read the cost map from main and bill input_cost_per_image as the
flat price of each DashScope image, so the row's $0.003 input fee billed every
qwen-image-3.0 image there at a tenth of its $0.03 price. A deployment can still
set input_cost_per_image to bill DashScope's input images

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-10-29 17:48:38 -07:00
..
__init__.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_dashscope_chat_transformation.py feat(dashscope)!: derive protocol bases from one domain (#47812) 2026-10-29 09:08:18 -07:00
test_dashscope_common_utils.py feat(dashscope)!: derive protocol bases from one domain (#47812) 2026-10-29 09:08:18 -07:00
test_dashscope_cost_calculator.py feat(dashscope): add separate explicit and implicit cache pricing (#45567) 2026-10-20 04:54:35 +00:00
test_dashscope_embedding_transformation.py feat(dashscope)!: derive protocol bases from one domain (#47812) 2026-10-29 09:08:18 -07:00
test_dashscope_image_edit_transformation.py feat(dashscope): add image edits and text-to-speech (#48998) 2026-10-29 17:48:38 -07:00
test_dashscope_messages_transformation.py feat(dashscope)!: derive protocol bases from one domain (#47812) 2026-10-29 09:08:18 -07:00
test_dashscope_rerank_transformation.py feat(dashscope)!: derive protocol bases from one domain (#47812) 2026-10-29 09:08:18 -07:00
test_dashscope_text_to_speech_transformation.py feat(dashscope): add image edits and text-to-speech (#48998) 2026-10-29 17:48:38 -07:00
test_dashscope_video_transformation.py feat(dashscope)!: derive protocol bases from one domain (#47812) 2026-10-29 09:08:18 -07:00
test_qwen_brand_aliases.py feat(dashscope)!: derive protocol bases from one domain (#47812) 2026-10-29 09:08:18 -07:00