litellm/tests/unit/llms/volcengine
Rick 1a1b924a6f
feat(volcengine): add Ark Seedream image generation, editing, and pricing (#54076)
* feat(volcengine): add Seedream image generation and editing

Co-Authored-By: AaronHowell <111272993+AaronHowell@users.noreply.github.com>

* feat(volcengine): price the Ark Seedream image models

Co-Authored-By: AaronHowell <111272993+AaronHowell@users.noreply.github.com>

* fix(volcengine): let a deployment image price override shared tiers

Co-Authored-By: AaronHowell <111272993+AaronHowell@users.noreply.github.com>

* fix(volcengine): bill only output images, price layer splits whole, and drop retired Seedream rows

Ark does not bill images it failed to output, so the cost calculator now skips data items with no url or b64_json. In a layer decomposition every output, the z_index 0 base included, bills at the layer rate.

Seedream 4.5, 5.0 lite and the 4.0 250828 snapshot were shut down on 2026-11-24 per Ark's deprecation notice, so their rows are removed and 4.0 is priced under its replacement IDs 260415 and 20260415.

Also regenerates provider_endpoints_support.json and clears the new type-discipline violations.

* fix(volcengine): resolve image api_base and key like chat, bill deployment prices first, and keep stream away from Ark

Image generation and edits now use api_base as given with the same default
and key order as Volcengine chat, and no longer read ARK_API_BASE. A user
longer than Ark's 64-character safety_identifier limit is sent as its sha256.
stream is rejected (or dropped with drop_params) whether it arrives top-level
or inside extra_body, edits keep fanning out n after a dropped stream, and a
multipart stream="false" is not a stream request. Edits forward extra_body
fields to Ark. A deployment's own per-image and tier prices now win over the
shared layer and tier rows

* fix(volcengine): send extra_headers to Ark, read ARK_API_BASE, price BytePlus Seedream names

Image generation sends deployment and caller extra_headers as HTTP headers again, so a caller Authorization header replaces the Ark key, and keeps them out of the JSON body. The endpoint falls back to VOLCENGINE_API_BASE, then ARK_API_BASE. BytePlus dola-* and seedream-* names get rows at BytePlus's USD list price, and the 2K tier starts past 1536^2 x 1.05^2 pixels as Ark's price page states.

* fix(volcengine): keep deployment prices, SDK retries and async calls on Seedream images

A deployment priced per pixel or per input image is billed by its own price again.
Direct SDK generation retries a 429 or 5xx twice by default, honors max_retries and
leaves retries to the router on proxy calls. Async generation runs on the async
handler, forwarded client headers reach Ark, n above the fan-out cap is dropped
with drop_params, and stream in extra_body no longer skips the edit fan-out

* fix(volcengine): read the Volcengine env keys before litellm.api_key on Seedream images

A global litellm.api_key set for another provider no longer reaches Ark when VOLCENGINE_API_KEY or ARK_API_KEY is set, matching Volcengine chat. Adds a test for a deployment that sets both image prices.

* fix(volcengine): bill a deployment's own Seedream tier prices when it also prices input images

A deployment that set input_cost_per_image with output_cost_per_image_1K or _2K fell back to the default image calculator, which billed only the input price. Tier prices now count as an output price for Volcengine, so the provider calculator bills each image at its tier. Also drops a test that only checked config classes

* fix(volcengine): keep a supplied OpenAI client's key and base URL on Seedream image generation

* fix(volcengine): send Seedream generation through a supplied OpenAI client's own http_client and retries

* fix(volcengine): wrap a supplied OpenAI client's http_client through http_handler

* fix(volcengine): keep a caller's async client on connection errors and let a call max_retries win

---------

Co-authored-by: AaronHowell <111272993+AaronHowell@users.noreply.github.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-26 07:52:44 +00:00
..
embedding
image_edit feat(volcengine): add Ark Seedream image generation, editing, and pricing (#54076) 2026-11-26 07:52:44 +00:00
image_generation feat(volcengine): add Ark Seedream image generation, editing, and pricing (#54076) 2026-11-26 07:52:44 +00:00
responses fix(proxy): forward limit, order, after, before and include on GET /v1/responses/{id}/input_items (#51259) 2026-11-20 07:54:26 -08:00
__init__.py
test_volcengine.py fix(openai): send chat completions through client.post so the SDK's per-message param transform stops holding the event loop (#46967) 2026-10-16 18:06:01 -07:00
test_volcengine_embedding.py fix(llms): sanitize trailing slashes in provider get_complete_url (#42887) 2026-10-15 02:59:46 -07:00
test_volcengine_video_transformation.py feat(videos): add first-class OpenRouter video request fields (#50319) 2026-11-06 16:50:48 -08:00