Commit graph

971 commits

Author SHA1 Message Date
Sameer Kankute
5ac4fb512c Add support for voyage-context-3 embedding model 2025-08-22 00:15:12 +05:30
Krish Dholakia
422447b7f1
Responses API - add default api version for openai responses api calls + Openrouter - fix claude-sonnet-4 on openrouter + Azure - Handle openai/v1/responses
Responses API - add default api version for openai responses api calls + Openrouter - fix claude-sonnet-4 on openrouter + Azure - Handle `openai/v1/responses`
2025-08-18 18:59:28 -07:00
Ishaan Jaff
ba0881d728
[Bug Fix] image_edit() function returns APIConnectionError with litellm_proxy - Support for both image edits and image generations (#13735)
* add image edits litellm proxy on SDK

* add image gen provider

* add IMG Gen support for litellm_proxy provider
2025-08-18 18:26:32 -07:00
Krrish Dholakia
ff7bdb6290 fix(mistral/chat/transformation.py): handle empty message content for mistral calls
Fixes https://github.com/BerriAI/litellm/issues/13355
2025-08-16 00:41:11 -07:00
Krrish Dholakia
b83b1686c2 feat(support-allowed_openai_params-for-responses-api): Fixes https://github.com/BerriAI/litellm/issues/13559 2025-08-16 00:23:37 -07:00
Jugal D. Bhatt
aea0605eed
[LLM Translation] Fix Realtime API endpoint for no intent (#13476)
* fix intent params

* Add responses

* fix unrelated test

* test fix - fireworks API endpoint is down

* test fix fireworks ai is having an active outage

* test_completion_cost_databricks

* dbrx fix test API currently not responding

* Update OpenAI Realtime handler to use the correct endpoint and include all query parameters. Adjusted error messages for missing API base and key. Updated health check URL construction to pass model as a query parameter.

* Enhance OpenAI Realtime handler tests to ensure model parameter inclusion in WebSocket URL. Added new tests to verify correct URL construction with model and additional parameters, preventing 'missing_model' errors. Updated existing tests for consistency.

* Remove debug print statements for API base and key in OpenAIRealtime handler to clean up the code.

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2025-08-14 16:24:14 -07:00
Krish Dholakia
f00e891004
LiteLLM SDK <-> Proxy: support user param + Prisma - remove use_prisma_migrate flag - redundant as this is now default (#13555)
* fix(litellm_proxy/chat/transformation.py): support 'user' and all other openai chat completion params

Fixes issue where 'user' was not being sent in request to litellm proxy via sdk

* fix(prisma_migration.py): remove 'use_prisma_migrate' flag, is now default

* docs: cleanup docs

* fix(proxy_cli.py): remove --use_prisma_migrate flag

* refactor: remove references to use_prisma_migrate env var

This is now the default flow for db migrations
2025-08-12 22:03:39 -07:00
Ishaan Jaff
828e3e3deb
[Feat] Add Streaming support + Docs for bedrock gpt-oss model family (#13346)
* add openai.gpt-oss-20b-1:0

* update BEDROCK_CONVERSE_MODELS

* openai.gpt-oss-20b-1:0 fixes

* fix PDF input

* fix for should_fake_stream

* TestBedrockGPTOSS

* should_fake_stream

* update supports vision field for openai.gpt-oss models

* fixes for bedrock gpt oss

* fixes for should_fake_stream

* docs bedrock gpt oss models
2025-08-12 08:39:36 -07:00
Krrish Dholakia
79e262d12b feat(common_utils.py): make default azure openai responses api use /openai/v1/responses logic
Fixes https://github.com/BerriAI/litellm/issues/13527#issuecomment-3177882103
2025-08-11 23:40:05 -07:00
Ishaan Jaff
9f78287000
[Bug Fix]: Azure OpenAI GPT-5 max_tokens + reasoning param support (#13510)
* add AzureOpenAIGPT5Config

* add AzureOpenAIGPT5Config

* add AzureOpenAIGPT5Config

* add AzureOpenAIGPT5Config

* test_azure_gpt5_supports_reasoning_effort

* test_azure_gpt5_reasoning

* test_azure_gpt5_reasoning

* ruff check fixes

* docs azure gpt5
2025-08-11 15:40:53 -07:00
Ishaan Jaff
1cd827874f
[Bug Fix] - Allow using reasoning_effort for gpt-5 model family and reasoning for Responses API (#13475)
* test_openai_gpt5_reasoning

* test_openai_gpt5_reasoning_effort_parameter

* add OpenAIGPT5ResponsesAPIConfig

* test_openai_gpt5_reasoning_effort_parameter

* fixes
2025-08-10 09:55:36 -07:00
Ishaan Jaff
621b3dca7b
[Bug Fix] Mistral Tool Calling - Grammar error: at 3(11): failed to compile JSON schema (#13389)
* test_claude_tool_use_with_gemini

* add _remove_json_schema_refs

* add _clean_tool_schema_for_mistral

* fixes mistral tool calls

* _remove_json_schema_refs

* fix - vertex, remove hardcoded test
2025-08-07 13:50:22 -07:00
Ishaan Jaff
5a02eb473b test_function_calling_with_tool_response 2025-08-05 09:55:47 -07:00
Krish Dholakia
416da066eb
fix(main.py): handle tool being a pydantic object (#13274)
* fix(main.py): handle tool being a pydantic object

Fixes https://github.com/BerriAI/litellm/issues/13064

* fix(prompt_templates/common_utils.py): fix unpack defs deepcopy issue

Fixes https://github.com/BerriAI/litellm/issues/13151

* fix(utils.py): handle tools is none
2025-08-04 23:44:02 -07:00
Ishaan Jaff
cf4c639dad test fix xai - it goes through base llm tests already 2025-07-30 18:18:49 -07:00
Krrish Dholakia
09cc748871 test: handle api instability 2025-07-30 16:32:23 -07:00
Krrish Dholakia
378db1b62d test: remove o1-preview 2025-07-28 17:47:57 -07:00
Krrish Dholakia
16af2d9a50 test: skip dbrx claude 3-7 sonnet test - rate limit errors 2025-07-28 17:34:42 -07:00
Krish Dholakia
1737cf4257
VertexAI - camelcase optional params for image generation + Anthropic - streaming, always ensure assistant role set on only first chunk (#12889)
* fix(vertex_ai/image_generation): transform `_` param to camelcase

Fixes https://github.com/BerriAI/litellm/issues/12690

* test(test_vertex_image_generation.py): add unit tests

* fix(streaming_handler.py): assert only 1 assistant chunk in stream

Fixes https://github.com/BerriAI/litellm/issues/12616

* fix(streaming_handler.py): fix check
2025-07-27 10:09:43 -07:00
Ishaan Jaff
461cd0c30a test_completion_cost_deepseek 2025-07-23 13:16:12 -07:00
Ishaan Jaff
c21dc46a33 fix morph api tests 2025-07-22 18:44:44 -07:00
Ishaan Jaff
bf300f8ca7 Revert "Litellm dev 07 21 2025 p1 (#12848)"
This reverts commit e4e10aa4ed.
2025-07-22 18:28:36 -07:00
Ishaan Jaff
31e9303232 remove old test 2025-07-22 14:11:43 -07:00
Krish Dholakia
e4e10aa4ed
Litellm dev 07 21 2025 p1 (#12848)
* fix(main.py): fix async retryer

Fixes https://github.com/BerriAI/litellm/issues/12830

* fix(forward_clientside_headers_by_model_group.py): filter out 'content-type' from forwardable headers

clientside content-type != proxy content type, can cause requests to hang

* test(tests/): update tests
2025-07-21 22:09:39 -07:00
Cole McIntosh
ff22aed1ea
Merge pull request #12826 from colesmcintosh/feature/add-hyperbolic-provider 2025-07-21 20:10:45 -06:00
Tomáš Dvořák
270e3d75db
fix(watsonx): use correct parameter name for tool choice (#9980)
Closes BerriAI/litellm#9979
2025-07-21 19:01:10 -07:00
Ishaan Jaff
4a7b9dee5f test fix - anthropic deprecated claude 2 2025-07-21 18:22:39 -07:00
Cole McIntosh
34ccda10ed Merge upstream/main - resolve conflicts to include both hyperbolic and recraft providers 2025-07-21 17:38:17 -06:00
Cole McIntosh
c5b51cd2b4
feat: add Morph provider support (#12821)
* feat: add Morph provider support

- Add MorphChatConfig implementation for OpenAI-compatible API
- Support morph-v3-fast and morph-v3-large models
- Add pricing: morph-v3-fast (/bin/zsh.8/.2 per 1M tokens), morph-v3-large (/bin/zsh.9/.9 per 1M tokens)
- Both models support 16k context window and system messages
- Add comprehensive documentation and unit tests
- Update all necessary integration points (constants, init, provider logic)

* feat: Add Morph provider support in ProviderConfigManager

- Extend ProviderConfigManager to include MorphChatConfig for the Morph LLM provider.
- Update MorphChatConfig by removing unused parameters from the configuration.
2025-07-21 13:52:45 -07:00
Cole McIntosh
6040c329a4 feat: add Hyperbolic provider support
- Add Hyperbolic as a new OpenAI-compatible provider
- Implement HyperbolicChatConfig inheriting from OpenAILikeChatConfig
- Register Hyperbolic in provider lists and constants
- Add comprehensive model configurations with pricing for:
  - DeepSeek models (V3, R1, etc.)
  - Qwen models (2.5, 3, QwQ, etc.)
  - Meta Llama models (3.1, 3.2, 3.3)
  - Other models like Kimi K2, Hermes 3, etc.
- Configure default API base URL: https://api.hyperbolic.xyz/v1
- Add provider documentation with usage examples
- Create unit tests for provider functionality
- Support all standard OpenAI parameters

Hyperbolic provides low-cost inference with OpenAI-compatible APIs,
supporting latest models without infrastructure overhead.
2025-07-21 13:18:50 -06:00
Cole McIntosh
41436fefa0
feat: Add Lambda AI provider support (#12817)
* feat: add Lambda AI provider support

Add support for Lambda AI (lambda.ai) as a new LLM provider in LiteLLM. Lambda AI provides access to a wide range of open-source models through their cloud GPU infrastructure.

Changes:
- Add Lambda AI provider implementation (OpenAI-compatible)
- Register 20 Lambda AI models with accurate pricing and 131k context windows
- Add comprehensive tests for Lambda AI integration
- Add detailed documentation with usage examples
- Use "lambda_ai" as provider name to avoid Python keyword conflict

Models include Llama 3.x, DeepSeek, Hermes, Qwen, and specialized models for coding and vision tasks.

* fix(tests): ensure lambda_ai_models list is repopulated after model cost reload

Updated test cases to clear and repopulate the lambda_ai_models list after reloading the model cost map. This ensures that the tests accurately reflect the current state of available models.

* feat: add Lambda AI chat configuration support

Added support for Lambda AI chat configuration in the ProviderConfigManager. This enhancement allows the integration of Lambda AI as a provider, expanding the capabilities of LiteLLM.
2025-07-21 10:23:10 -07:00
Jugal D. Bhatt
55f6460c35
[LLM Translation] Add Gov Cloud bedrock model pricing and context windows (#12773)
* Feature/track bedrock gov cloud models (#12771)

* feat: add AWS Bedrock GovCloud model support (LIT-257)

- Added 18 GovCloud-specific model entries (9 per region) to model_prices_and_context_window.json
- Updated is_bedrock_pricing_only_model() to allow GovCloud models (us-gov-east-1, us-gov-west-1)
- Added comprehensive test suite for GovCloud model support
- Ensures GovCloud models use appropriate APIs (Converse for Claude/Llama, Invoke for Titan)

Models added:
- Claude 3.5 Sonnet and Claude 3 Haiku (FedRAMP/IL4/5 approved)
- Llama 3 8B and 70B (FedRAMP/IL4/5 approved)
- Amazon Titan Text and Embedding models

* fix: add bedrock_converse GovCloud model mappings for Claude models

Added missing bedrock_converse model entries for AWS GovCloud regions:
- bedrock_converse/us-gov-east-1/anthropic.claude-3-5-sonnet-20240620-v1:0
- bedrock_converse/us-gov-east-1/anthropic.claude-3-haiku-20240307-v1:0
- bedrock_converse/us-gov-west-1/anthropic.claude-3-5-sonnet-20240620-v1:0
- bedrock_converse/us-gov-west-1/anthropic.claude-3-haiku-20240307-v1:0

This fixes test failures where supports_tool_choice() returned True but
the models weren't properly mapped in the configuration files.

* fix: correct AWS GovCloud Bedrock model pricing and configurations

- Fix Claude 3.5 Sonnet pricing (3.6e-06 input, 1.8e-05 output)
- Fix Claude 3 Haiku pricing (3e-07 input, 1.5e-06 output)
- Update Claude 3.5 Sonnet max_tokens from 4096 to 8192
- Add bedrock_converse entries for Llama models with correct token limits
- Add Amazon Nova Pro model for both GovCloud regions
- Add supports_pdf_input flag to Claude models

* fix: handle bedrock_converse prefix in get_non_litellm_routing_model_name

Fixes test failure where bedrock_converse/region/model paths were not properly
stripped to get the base model name, causing supports_function_calling to
return false for regional bedrock_converse models.

* revert: reset bedrock/common_utils.py to match main branch

Remove bedrock_converse prefix handling from get_non_litellm_routing_model_name
to align with main branch implementation.

* revert: reset litellm/__init__.py to match main branch

- Remove public_model_groups variables
- Remove GovCloud exception handling in is_bedrock_pricing_only_model
- Fix comment formatting

* revert: reset litellm/__init__.py to exact main branch content

Copy exact content from origin/main with no modifications

* fix: remove bedrock_converse prefixed models from pricing files

- Remove 10 bedrock_converse entries from model_prices_and_context_window.json
- Remove 4 bedrock_converse entries from litellm/model_prices_and_context_window_backup.json
- These were GovCloud-specific entries that are no longer needed

* fix: correct AWS GovCloud Bedrock model pricing and configurations

- Fix Anthropic Claude 3.5 Sonnet pricing: $3.60/$18.00 per million tokens (was $3.00/$15.00)
- Fix Anthropic Claude 3 Haiku pricing: $0.30/$1.50 per million tokens (was $0.25/$1.25)
- Fix Claude 3.5 Sonnet max_tokens: 8192 (was 4096)
- Fix Llama model max_tokens: 2048 (was 8192) and max_input_tokens: 8000 (was 8192)
- Fix Llama3-8b output pricing: $2.65 per million tokens (was $0.60)
- Add missing Amazon Nova Pro models for both GovCloud regions
- Add supports_pdf_input flag to Llama models

Based on official AWS Bedrock pricing documentation for GovCloud regions

* test: fix GovCloud bedrock models test to match implementation

Update test_govcloud_model_in_bedrock_models_list to correctly verify that
GovCloud models are excluded from bedrock_models list as they are
pricing-only models following the bedrock/<region>/<model> pattern.

---------

Co-authored-by: Cole McIntosh <colemcintosh6@gmail.com>
Co-authored-by: Cole McIntosh <82463175+colesmcintosh@users.noreply.github.com>

* add tests

* add tests

* Added test costs

* Added test costs

---------

Co-authored-by: Cole McIntosh <colemcintosh6@gmail.com>
Co-authored-by: Cole McIntosh <82463175+colesmcintosh@users.noreply.github.com>
2025-07-19 16:12:05 -07:00
Ishaan Jaff
84595851b6 TestMistralCompletion 2025-07-19 15:37:13 -07:00
Cole McIntosh
bf046c9d5d
feat: add v0 provider support (#12751)
* feat: add v0 provider support to LiteLLM

- Add v0 as a new OpenAI-compatible provider
- Support all three v0 models: v0-1.0-md, v0-1.5-md, v0-1.5-lg
- Configure correct token limits and pricing for each model
- Enable vision support for all v0 models (multimodal)
- Add provider detection for v0/ prefix and api.v0.dev endpoint
- Include comprehensive unit tests for the provider

The v0 provider uses the standard OpenAI-compatible implementation
and supports all standard features including streaming, function
calling, and system messages.

* fix: add v0 provider to ProviderConfigManager

Add V0ChatConfig to the get_provider_chat_config method to fix
test_supports_tool_choice test failure. The v0 provider needs to
be included in the provider config manager to return the correct
configuration for tool choice support detection.

* docs: add documentation for v0 provider

- Add comprehensive v0 provider documentation
- Cover all supported models and their capabilities
- Include examples for SDK usage, proxy configuration, and all features
- Document supported OpenAI parameters based on v0 API docs
- Add v0 to the providers sidebar navigation

* fix: correct v0 supported OpenAI parameters

Based on review feedback and v0 API documentation:
- v0 only supports: messages, model, stream, tools, tool_choice
- Remove unsupported parameters like temperature, max_tokens, etc.
- Update tests to verify correct parameter set
- Update documentation to reflect actual API capabilities
- Remove JSON mode example as response_format is not supported

Reference: https://v0.dev/docs/v0-model-api#request-body

* fix: remove supports_response_schema from v0 models

Remove the supports_response_schema property from all v0 models in the model configuration files as v0 does not support this feature.

Models updated:
- v0/v0-1.0-md
- v0/v0-1.5-md
- v0/v0-1.5-lg
2025-07-18 18:26:44 -07:00
Krish Dholakia
f6f3f151f1
Anthropic - add tool cache control support (#12668)
* fix(prompt_templates/factory.py): handle anthropic cache control on individual tool results

Fixes issue where cache control on individual tool result was being ignored

* test(test_vertex_And_google_ai_studio_gemini.py): initial unit test covering translation for grounding metadata on streaming chunk
2025-07-18 11:14:03 -07:00
Krish Dholakia
60c7537cc7
/streamGenerateContent - non-gemini model support (#12647)
* fix(google_genai/adapters/transformation.py): enable calling non-googlegenai models via streaming

Fixes https://github.com/BerriAI/litellm/issues/12562

* test(test_openai.py): add unit test asserting streaming works as expected
2025-07-18 10:56:29 -07:00
Krrish Dholakia
f4131b023e fix: don't fail request if unmapped item in responses list
not every responses item has a 1:1 mapping with chat completions
2025-07-16 09:25:26 -07:00
Ishaan Jaff
e8a748161f
[Bug Fix] grok-4 does not support the stop param (#12646)
* bug fix - using stop reason with grok 4

* fixes for XAI stop params

* test_xai_grok_4_stop_not_supported

* test_xai_grok_4_stop_not_supported
2025-07-16 09:19:25 -07:00
Krrish Dholakia
5a8762b6a1 test: update tests 2025-07-16 08:56:41 -07:00
Krish Dholakia
1ce3558f96
fix(transformation.py): allows passing native responses api tools like web_search_preview, and mcp via .completion() (#12627)
Closes https://github.com/BerriAI/litellm/issues/12105
2025-07-15 22:45:42 -07:00
Krish Dholakia
955b504f7b
fix(proxy_server.py): fixes for handling team only models via `/v2/mo… (#12632)
* fix(proxy_server.py): fixes for handling team only models via `/v2/model/info`

ensures team only models show up on the correct team on `Models + Endpoints`

* test: update tests
2025-07-15 22:36:05 -07:00
Marcelo Díaz
094ce8f772
feat(gemini): Add custom TTL support for context caching (#9810) (#12541)
- Add ttl parameter to cache_control for Gemini models
- Support Google's TTL format (e.g., '3600s', '7200s')
- Implement robust TTL extraction and validation
- Extract TTL before system message transformation to handle all cases
- Add comprehensive test suite with 17 test cases in tests/test_litellm/
- Update documentation with TTL usage examples
- Maintain backward compatibility with existing cache_control usage

Fixes #9810
2025-07-14 22:30:54 -07:00
Ishaan Jaff
cf5b4c0497 ruff check ./litellm --fix 2025-07-12 11:04:02 -07:00
dotmobo
e69107466f [TECH] fix TU 2025-07-08 16:16:12 +02:00
Ishaan Jaff
e7374e3909 test_gemini_url_context 2025-07-03 16:13:44 -07:00
Ishaan Jaff
274baac9df test_mcp_tools_with_responses_api 2025-07-03 14:53:30 -07:00
Ishaan Jaff
03a589d323 fix - MCP deepwiki mcp is unstable, move to stable mcp 2025-07-03 14:24:32 -07:00
Ishaan Jaff
5630147e80 Revert "Revert "fix tests (#12286)""
This reverts commit 12f157513b.
2025-07-03 12:08:27 -07:00
Ishaan Jaff
12f157513b Revert "fix tests (#12286)"
This reverts commit 99ce3a24cc.
2025-07-03 12:04:23 -07:00
célina
99ce3a24cc
fix tests (#12286) 2025-07-03 10:57:19 -07:00