Commit graph

4515 commits

Author SHA1 Message Date
Krrish Dholakia
91949be3bd docs(bedrock.md): add amazon nova to docs 2025-03-11 23:13:28 -07:00
Krrish Dholakia
e0fbfb5e35 fix(azure/audio_transcriptions.py): support azure cost tracking
extract content time and log correctly as duration
2025-03-11 22:25:13 -07:00
Krrish Dholakia
c784b8b74c fix(internal_user_endpoints.py): allow internal user to query their own info, without knowing their id
make it easy to debug when admin endpoints don't work as expected
2025-03-11 20:24:51 -07:00
Ishaan Jaff
a5634265aa ui new build 2025-03-11 12:22:12 -07:00
Steve Farthing
198f1765bb Merge branch 'stevefarthing/bing-search-pass-thru' of github.com:sfarthin/litellm into stevefarthing/bing-search-pass-thru
# Conflicts:
#	litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
2025-03-11 08:15:23 -04:00
Steve Farthing
b79b126597 Merge branch 'main' into stevefarthing/bing-search-pass-thru 2025-03-11 08:06:56 -04:00
Steve Farthing
227ae4d8b3 Feedback 2025-03-11 08:01:31 -04:00
Steve Farthing
f8b35d16f1 Bing Search Pass Thru 2025-03-11 08:01:31 -04:00
Krish Dholakia
1dce61b8c9 Merge pull request #9109 from BerriAI/litellm_dev_03_10_2025_p1_v2
Return `code`, `param` and `type` on openai bad request error
2025-03-10 22:38:16 -07:00
Krish Dholakia
b4921a37a0 Merge pull request #9047 from BerriAI/litellm_dev_03_06_2025_p4
feat(handle_jwt.py): support multiple jwt url's
2025-03-10 22:37:35 -07:00
Krrish Dholakia
3040fde008 fix: fix test 2025-03-10 21:46:05 -07:00
Krrish Dholakia
e58c18611f fix: fix linting error 2025-03-10 21:22:00 -07:00
Ishaan Jaff
010b1c8b1e ui new build 2025-03-10 21:05:00 -07:00
Krrish Dholakia
b14b8d37df feat(credential_endpoints/endpoints.py): don't return credentials on get
prevent leakage
2025-03-10 20:11:38 -07:00
Ishaan Jaff
5300d39feb can_team_access_model 2025-03-10 20:03:19 -07:00
Krrish Dholakia
a87f822c50 feat: working e2e credential management - support reusing existing credentials 2025-03-10 19:29:24 -07:00
Ishaan Jaff
27cb1c8e1f test_can_team_access_model fix 2025-03-10 19:09:50 -07:00
Ishaan Jaff
5588b1ba81 Merge branch 'main' into litellm_fix_team_model_access_checks 2025-03-10 19:05:11 -07:00
Krrish Dholakia
2fddb59c23 feat: complete crud endpoints for credential management on proxy 2025-03-10 18:46:35 -07:00
Krish Dholakia
581e6a7576 Merge branch 'main' into litellm_dev_03_06_2025_p4 2025-03-10 18:41:10 -07:00
Krrish Dholakia
994d438720 fix(endpoints.py): encrypt credentials before storing in db 2025-03-10 18:37:59 -07:00
Krrish Dholakia
6647e962a1 feat(endpoints.py): support writing credentials to db 2025-03-10 18:27:43 -07:00
Krrish Dholakia
e6d9aa051e feat(endpoints.py): initial set of crud endpoints for reusable credentials on proxy 2025-03-10 17:48:02 -07:00
Krrish Dholakia
e518e3558b feat(credential_accessor.py): support loading in credentials from credential_list
Resolves https://github.com/BerriAI/litellm/issues/9114
2025-03-10 17:15:58 -07:00
Krrish Dholakia
236e68910c feat(proxy_server.py): move credential list to being a top-level param 2025-03-10 17:04:05 -07:00
Krrish Dholakia
1e89fdec99 fix(router.py): comment out azure/openai client init - not necessary 2025-03-10 16:47:43 -07:00
Krrish Dholakia
c71af5b92e feat(proxy_server.py): check code before defaulting to status code 2025-03-10 15:34:06 -07:00
Krish Dholakia
91b41204fb Litellm dev 03 08 2025 p3 (#9089)
* feat(ollama_chat.py): pass down http client to ollama_chat

enables easier testing

* fix(factory.py): fix passing images to ollama's `/api/generate` endpoint

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

* fix(factory.py): fix ollama pt to handle templating correctly
2025-03-09 18:20:56 -07:00
Ishaan Jaff
117a1e1226 (UI) - Fix show correct count of internal user keys on Users Page (#9082)
* get_user_key_counts

* fix get_user_key_counts

* fix get_user_key_counts

* test_get_users_filters_dashboard_keys

* remove unused func
2025-03-08 16:13:18 -08:00
Ishaan Jaff
0462ab14d8 (Clean up) - Allow switching off storing Error Logs in DB (#9084)
* fix - cleanup, dont store ErrorLogs in 2 tables

* async_post_call_failure_hook

* docs disable error logs

* disable_error_logs
2025-03-08 16:12:03 -08:00
Krish Dholakia
44c9eef64f Fix batches api cost tracking + Log batch models in spend logs / standard logging payload (#9077)
* feat(batches/): fix batch cost calculation - ensure it's accurate

use the correct cost value - prev. defaulting to non-batch cost

* feat(batch_utils.py): log batch models to spend logs + standard logging payload

makes it easy to understand how cost was calculated

* fix: fix stored payload for test

* test: fix test
2025-03-08 11:47:25 -08:00
Krish Dholakia
9fc7bd0493 UI - new API Playground for testing LiteLLM translation (#9073)
* feat: initial commit - enable dev to see translated request

* feat(utils.py): expose new endpoint - `/utils/transform_request` to see the raw request sent by litellm

* feat(transform_request.tsx): allow user to see their transformed request

* refactor(litellm_logging.py): return raw request in 3 parts - api_base, headers, request body

easier to render each individually on UI vs. extracting from combined string

* feat: transform_request.tsx

working e2e raw request viewing

* fix(litellm_logging.py): fix transform viewing for bedrock models

* fix(litellm_logging.py): don't return sensitive headers in raw request headers

prevent accidental leak

* feat(transform_request.tsx): style improvements
2025-03-07 19:39:31 -08:00
Ishaan Jaff
b6376a1a64 (Docs) OpenWeb x LiteLLM Docker compose + Instructions on spend tracking + logging (#9059)
* docs improve open web ui litellm doc

* docs openweb show teams + keys

* docs open web ui litellm
2025-03-07 17:01:39 -08:00
Ishaan Jaff
5df79ad7e3 (Feat) - add pricing for eu.amazon.nova models (#9056)
* add pricing for eu.amazon.nova models

* fix typo in key management endpoints.py
2025-03-07 07:06:17 -08:00
Krish Dholakia
da13ec2b64 Support master key rotations (#9041)
* feat(key_management_endpoints.py): adding support for rotating master key

* feat(key_management_endpoints.py): support decryption-re-encryption of models in db, when master key rotated

* fix(user_api_key_auth.py): raise valid token is None error earlier

enables easier debugging with api key hash in error message

* feat(key_management_endpoints.py): rotate any env vars

* fix(key_management_endpoints.py): uncomment check

* fix: fix linting error
2025-03-06 23:13:30 -08:00
Krrish Dholakia
5280a914cd feat(handle_jwt.py): support multiple jwt url's 2025-03-06 23:05:54 -08:00
Krish Dholakia
aca6811d3b fix(team_endpoints.py): ensure 404 raised when team not found (#9038)
* fix(team_endpoints.py): ensure 404 raised when team not found

* fix(key_management_endpoints.py): fix adding tags to key when metadata is empty

* fix(key_management_endpoints.py): refactor set metadata field to use common function across keys + teams

reduces scope for errors + easier testing

* fix: fix linting error
2025-03-06 22:04:36 -08:00
Ishaan Jaff
0b6d7f7828 ui new build 2025-03-06 21:22:58 -08:00
Ishaan Jaff
76697ba3c8 ui allow ui or eu api base adding model (#9042) 2025-03-06 21:22:03 -08:00
Ishaan Jaff
6ec1f82521 (Docs) connect litellm to open web ui (#9040)
* init doc

* working thinking tutorial

* docs open web ui with litellm

* minor edits

* docs one tab for tutorials
2025-03-06 21:13:00 -08:00
Ishaan Jaff
5b2eb1f6bb (AWS Secret Manager) - Using K/V pairs in 1 AWS Secret (#9039)
* fixes for primary_secret_kv_pairs

* _parse_primary_secret

* Using K/V pairs in 1 AWS Secret

* test_primary_secret_functionality
2025-03-06 19:30:18 -08:00
Ishaan Jaff
bfbbac38fc [Feat] - Display thinking tokens on OpenWebUI (Bedrock, Anthropic, Deepseek) (#9029)
* if merge_reasoning_content_in_choices

* _optional_combine_thinking_block_in_choices

* stash changes

* working merge_reasoning_content_in_choices with bedrock

* fix litellm_params accessor

* fix streaming handler

* merge_reasoning_content_in_choices

* _optional_combine_thinking_block_in_choices

* test_bedrock_stream_thinking_content_openwebui

* merge_reasoning_content_in_choices

* fix for _optional_combine_thinking_block_in_choices

* linting error fix
2025-03-06 18:32:58 -08:00
Ishaan Jaff
84a83f8c51 (Refactor) /v1/messages to follow simpler logic for Anthropic API spec (#9013)
* anthropic_messages_handler v0

* fix /messages

* working messages with router methods

* test_anthropic_messages_handler_litellm_router_non_streaming

* test_anthropic_messages_litellm_router_non_streaming_with_logging

* AnthropicMessagesConfig

* _handle_anthropic_messages_response_logging

* working with /v1/messages endpoint

* working /v1/messages endpoint

* refactor to use router factory function

* use aanthropic_messages

* use BaseConfig for Anthropic /v1/messages

* track api key, team on /v1/messages endpoint

* fix get_logging_payload

* BaseAnthropicMessagesTest

* align test config

* test_anthropic_messages_with_thinking

* test_anthropic_streaming_with_thinking

* fix - display anthropic url for debugging

* test_bad_request_error_handling

* test_anthropic_messages_router_streaming_with_bad_request

* fix ProxyException

* test_bad_request_error_handling_streaming

* use provider_specific_header

* test_anthropic_messages_with_extra_headers

* test_anthropic_messages_to_wildcard_model

* fix gcs pub sub test

* standard_logging_payload

* fix unit testing for anthopic /v1/messages support

* fix pass through anthropic messages api

* delete dead code

* fix anthropic pass through response

* revert change to spend tracking utils

* fix get_litellm_metadata_from_kwargs

* fix spend logs payload json

* proxy_pass_through_endpoint_tests

* TestAnthropicPassthroughBasic

* fix pass through tests

* test_async_vertex_proxy_route_api_key_auth

* _handle_anthropic_messages_response_logging

* vertex_credentials

* test_set_default_vertex_config

* test_anthropic_messages_litellm_router_non_streaming_with_logging

* test_ageneric_api_call_with_fallbacks_basic

* test__aadapter_completion
2025-03-06 00:43:08 -08:00
Krrish Dholakia
a5f2b79264 fix: fix linting error 2025-03-05 10:10:53 -08:00
Ishaan Jaff
2cc590938f Revert "(UI) - Security Improvement, move to JWT Auth for Admin UI Sessions (#8995)"
This reverts commit 01a44a4e47.
2025-03-05 08:49:20 -08:00
Krrish Dholakia
71e02fb134 fix: fix linting error 2025-03-05 08:26:26 -08:00
Krish Dholakia
ecef915ac9 fix(base_aws_llm.py): remove region name before sending in args (#8998)
* fix(base_aws_llm.py): remove region name before sending in args

* fix(base_aws_llm.py): fix optional param pop position

* fix: fix linting error
2025-03-04 23:05:28 -08:00
Krrish Dholakia
4cd35205ae fix: fix linting error 2025-03-04 22:34:07 -08:00
Krish Dholakia
b43b8dc21c Litellm dev 03 04 2025 p3 (#8997)
* fix(core_helpers.py): handle litellm_metadata instead of 'metadata'

* feat(batches/): ensure batches logs are written to db

makes batches response dict compatible

* fix(cost_calculator.py): handle batch response being a dictionary

* fix(batches/main.py): modify retrieve endpoints to use @client decorator

enables logging to work on retrieve call

* fix(batches/main.py): fix retrieve batch response type to be 'dict' compatible

* fix(spend_tracking_utils.py): send unique uuid for retrieve batch call type

create batch and retrieve batch share the same id

* fix(spend_tracking_utils.py): prevent duplicate retrieve batch calls from being double counted

* refactor(batches/): refactor cost tracking for batches - do it on retrieve, and within the established litellm_logging pipeline

ensures cost is always logged to db

* fix: fix linting errors

* fix: fix linting error
2025-03-04 21:58:03 -08:00
Ishaan Jaff
f2a9d67e05 (UI) - Security Improvement, move to JWT Auth for Admin UI Sessions (#8995)
* (UI) - Improvements to session handling logic  (#8970)

* add cookieUtils

* use utils for clearing cookies

* on logout use clearTokenCookies

* ui use correct clearTokenCookies

* navbar show userEmail on UserID page

* add timestamp on token cookie

* update generate_authenticated_redirect_response

* use common getAuthToken

* fix clearTokenCookies

* fixes for get auth token

* fix invitation link sign in logic

* Revert "fix invitation link sign in logic"

This reverts commit 30e5308cb3.

* fix getAuthToken

* update setAuthToken

* fix ui session handling

* fix ui session handler

* bug fix stop generating LiteLLM Virtual keys for access

* working JWT insert into cookies

* use central place to build UI JWT token

* add _validate_ui_token

* fix ui session handler

* fix fetchWithCredentials

* check allowed routes for ui session tokens

* expose validate_session endpoint

* validate session endpoint

* call sso/session/validate

* getUISessionDetails

* ui move to getUISessionDetails

* /sso/session/validate

* fix cookie utils

* use getUISessionDetails

* use ui_session_id

* "/spend/logs/ui" in spend_tracking_routes

* working sign in JWT flow for proxy admin

* allow proxy admin to access ui routes

* use check_route_access

* update types

* update login method

* fixes to ui session handler

* working flow for admin and internal users

* fixes for invite links

* use JWTs for SSO sign in

* fix /invitation/new flow

* fix code quality checks

* fix _get_ui_session_token_from_cookies

* /organization/list

* ui sso sign in

* TestUISessionHandler

* TestUISessionHandler
2025-03-04 21:48:23 -08:00