litellm/tests/unit/proxy/public_endpoints
vikashmaddi-sarvam c030ffb6b9
feat(providers): add Sarvam Token Factory v2 models (#49792)
* feat(providers): add Sarvam Token Factory v2 models

🪷 Generated with Sarvam Code

* test(providers): drop beta model names from Sarvam tests

🪷 Generated with Sarvam Code

* feat(providers): list Sarvam in the Add Model provider fields

🪷 Generated with Sarvam Code

* fix(providers): address Sarvam review comments on pricing and tests

- add cached input pricing and source URLs to the six GA model rows
- mark glm5.3 and glm5.3-flash as prompt-cache capable
- restore the sarvam-m deprecation row with zero cache costs
- keep the pin-zero-one-hour-price integration case on sarvam/sarvam-m
- rewrite the unit tests with respx and the shared cost-map fixture

🪷 Generated with Sarvam Code

* fix(providers): address Sarvam review bot findings

- force store false on Sarvam Responses requests
- update DeepSeek standard rates and add the interactive SKU
- add behavioral cached-token billing tests and type annotations
- drop the no-setup test class

🪷 Generated with Sarvam Code

* fix(providers): price Sarvam models at 94 INR per USD

Align the Sarvam cost map with the Bifrost datasheet, which converts at 94 INR per USD. The INR rates are unchanged; only the USD figures move, by about 4.4%.

🪷 Generated with Sarvam Code

* test(providers): drop Sarvam Responses wiring test

The respx Responses tests already fail when Sarvam's Responses support is turned off, so the registry and config assertions added no coverage.

* fix(sarvam): drop the retired max_tokens field from the cost map rows

tests/unit/test_model_prices_and_context_window.py asserts that no cost-map row
carries max_tokens, which is retired in favour of max_input_tokens and
max_output_tokens. The seven Sarvam rows added by this branch still carried it,
so the root unit job failed on
test_no_row_carries_the_retired_max_tokens_field.

Removing the field leaves the limits unchanged: max_input_tokens and
max_output_tokens already carry the same values, and the two cost-map files
stay identical.

🪷 Generated with Sarvam Code

* fix(sarvam): keep Responses on the chat bridge and bill introductory rates

Drop /v1/responses and force_store_false from the sarvam provider so Responses calls go through the chat-completions bridge again, which keeps previous_response_id, store and v1 api_base working
Bill sarvam-105b and sarvam-105b-conversations at Sarvam's introductory rates (INR 10, 0.25 and 25 per 1M tokens through the end of 2026) and note the list rates on the promotional rows
Replace the tests that pinned the native Responses route, the max token key and cost map contents with behavior tests

* fix(sarvam): keep sarvam-105b models on the v1 API with a per-model base URL

* test(sarvam): type the model base URL tests

* fix(sarvam): forward reasoning_effort and cap sarvam-105b-conversations output at 8192

Registers sarvam in LlmProviders so the JSON provider config decides supported params, which forwards reasoning_effort on reasoning models instead of dropping it. max_completion_tokens still maps to max_tokens. sarvam-105b-conversations answers 400 above 8192 output tokens on /v1, so the cost map now says 8192

* test(sarvam): walk sarvam's chat route in the internal params wire test

* fix(sarvam): send text content lists to the v1 models as strings

Sarvam's /v1 API answers 400 for list-form message content, which Anthropic /v1/messages and Responses clients always send. A per-model model_special_handling key in providers.json flattens text lists for sarvam-105b and sarvam-105b-conversations only, since the v2 models take lists and images

* fix(sarvam): round reasoning_effort to declared levels and join text-only content lists by line

Sarvam rejects reasoning_effort levels a model does not accept, so map_openai_params now rounds the
requested level up to the next level the cost map declares for the model, or down to its strongest,
and drops none under drop_params when the model does not declare it. The v1 models now flatten only
all-text content lists, joining parts with a newline as Sarvam v2 does, and send lists with images
unchanged

* fix(sarvam): honor global drop_params when dropping reasoning_effort none

litellm.drop_params set in litellm_settings now drops an undeclared reasoning_effort the same way a per-call drop_params does, as other chat providers already OR in the global flag

* fix(sarvam): read reasoning levels from the shipped cost map and round only for sarvam

The router copies each deployment's model_info onto the shared
sarvam/<model> row in litellm.model_cost, so one deployment's
reasoning_effort_levels changed what its sibling deployments sent.
Rounding now reads the cost map as loaded, which registrations never
touch

Rounding also ran for every JSON provider whose cost map row declares
levels. A new round_reasoning_effort_to_declared_levels special_handling
flag turns it on, and only sarvam sets it

---------

Co-authored-by: Vikash Maddi <vikashmaddi-sarvam@users.noreply.github.com>
Co-authored-by: ryan-crabbe-berri <ryan@berri.ai>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-18 13:19:05 +00:00
..
public_v1 feat(proxy): publish opted-in pass-through endpoints on the Model Hub (#43905) 2026-11-12 17:46:38 +00:00
__init__.py ci: move tests/proxy_unit_tests to tests/unit/proxy and run the proxy-db shards from litellm-tests (#42903) 2026-09-24 22:59:11 +00:00
test_blog_posts_endpoint.py fix(proxy): fetch blog posts without blocking the event loop (#51369) 2026-11-12 10:32:44 -08:00
test_public_endpoints.py feat(providers): add Sarvam Token Factory v2 models (#49792) 2026-11-18 13:19:05 +00:00