Commit graph

42355 commits

Author SHA1 Message Date
Chesars
d33dec86ad fix: address Greptile review feedback
- Log provider token counting failures instead of silently swallowing
- Fall back to local tokenizer when provider returns error response
- Map assistant tool_calls to Responses API function_call items
- Concatenate multiple system messages instead of overwriting
- Hide internal error details from proxy API responses
- Narrow exception catch in handler to network/JSON errors only
- Update test to match new fallback behavior
2026-03-04 19:32:05 -03:00
Chesars
43d2a19f79 feat(openai): add OpenAI token counting API support and public litellm.acount_tokens()
- Add OpenAITokenCounter using POST /v1/responses/input_tokens endpoint
- Add litellm.acount_tokens() public async API that auto-routes to provider APIs
- Add proxy endpoint POST /v1/responses/input_tokens for OpenAI-compatible counting
- Transform chat tools format to Responses API format for correct token counting
- Fall back to local tiktoken when provider API unavailable

Fixes #22302
2026-03-04 19:32:05 -03:00
Harshit28j
63459d6777 docs: add JWT-to-Virtual-Key mapping documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 03:59:59 +05:30
Chesars
6fa9a0e52b fix(bfl): validate empty image list in edit handler
Raise explicit error instead of letting IndexError propagate when
an empty image list is passed to image_edit.
2026-03-04 19:23:37 -03:00
Cesar Garcia
835e4c4a75
Update litellm/llms/black_forest_labs/image_generation/transformation.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-04 19:20:19 -03:00
Cesar Garcia
d9f37011a2
Update litellm/llms/black_forest_labs/image_generation/transformation.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-04 19:20:03 -03:00
Cesar Garcia
92297df30c
Update docs/my-website/sidebars.js
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-04 19:19:30 -03:00
Harshit28j
2f15686ea2 fix: address greptile feedback - redact hashed tokens, proper error codes, add tests
- Remove token field from JWTKeyMappingResponse to prevent hashed key exposure
- Use _to_response() helper on all CRUD endpoints to control returned fields
- Return 409 for unique constraint violations, 400 for FK violations, 404 for not found
- Add response_model to endpoint decorators
- Add 8 new unit tests covering error handling and token redaction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 03:46:03 +05:30
Chesars
88dc0c1b18 feat(bfl): add kontext models to image generation support
Kontext models (flux-kontext-pro, flux-kontext-max) support both
text-to-image and image editing. Add them to IMAGE_GENERATION_MODELS
and update supported_endpoints in model prices JSON.
2026-03-04 19:12:28 -03:00
Chesars
7ee4a40fc4 fix(bfl): correct mode and variable shadowing from review feedback
- Change mode from "image_generation" to "image_edit" for all 4 BFL
  image edit models (flux-kontext-pro, flux-kontext-max, flux-pro-1.0-fill,
  flux-pro-1.0-expand)
- Rename shadowed api_base variable to complete_url in async handler
  for consistency with sync path
2026-03-04 19:07:36 -03:00
Cesar Garcia
6fa74af6c3
Update litellm/llms/black_forest_labs/image_edit/transformation.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-04 19:06:45 -03:00
Cesar Garcia
269911d6fe
Update litellm/llms/black_forest_labs/image_edit/handler.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-04 19:06:22 -03:00
Chesars
cf01ef5949 fix(tests): align BFL test assertions with implementation
- image_edit: get_supported_openai_params returns [] not [n, size, response_format]
- image_generation: remove response_format assertion (not in supported params)
- image_generation: unknown model raises ValueError, not defaults to flux-pro-1.1
2026-03-04 18:47:59 -03:00
giulio-leone
4d97818f98 fix(tools): gracefully repair truncated JSON in tool call arguments 2026-03-04 22:45:53 +01:00
giulio-leone
12691dcce3 fix: WebSearch interception fails with thinking enabled + SpendLimit constraint 2026-03-04 22:44:52 +01:00
giulio-leone
fb8bd60c7d fix(streaming): prevent Vertex AI Claude content truncation when finish_reason races content 2026-03-04 22:44:48 +01:00
Cesar Garcia
4059b4f942
Merge pull request #19280 from Chesars/docs/update-main-page-index
docs: sync main page with docs/index.md
2026-03-04 18:38:04 -03:00
Chesars
52d2ea237f fix(bfl): remove unsupported params and error on unknown models
- Remove response_format from supported params (BFL always returns URLs)
- Remove n and size from image edit supported params (not mapped)
- Raise ValueError on unknown model names instead of silently defaulting
2026-03-04 18:34:05 -03:00
Cesar Garcia
8eb7ca3726
Update litellm/llms/black_forest_labs/image_edit/transformation.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-04 18:26:47 -03:00
Chesars
00cf9550af fix(bfl): handle URL and file path inputs in image edit
_read_image_bytes was not handling string inputs (URLs or file paths),
causing a TypeError when passing a URL as the image source.
2026-03-04 18:16:21 -03:00
Cesar Garcia
d9d39d545a
Update litellm/llms/black_forest_labs/image_edit/transformation.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-04 18:11:50 -03:00
Chesars
727fd76841 refactor(bfl): separate HTTP logic into dedicated handlers
- Create handler.py for image generation and image edit
- Move polling logic from transformation to handlers
- Handlers use _get_httpx_client() / get_async_httpx_client()
- Transformation files now only transform request/response data
- Follows Bedrock pattern for provider-specific handlers

Addresses feedback: transformation files should not make HTTP requests
2026-03-04 18:10:09 -03:00
Chesars
a14a79619a docs: add Black Forest Labs image generation documentation 2026-03-04 18:09:52 -03:00
Chesars
e0af575ee8 feat(black_forest_labs): add image generation support
Add native text-to-image generation for Black Forest Labs Flux models
(flux-pro-1.1, flux-pro-1.1-ultra, flux-dev, flux-pro).

- Polling-based async API with sync and async support
- OpenAI-compatible parameter mapping (size, n, quality)
- Reuses shared HTTP clients via _get_httpx_client()
- 39 unit tests added
2026-03-04 18:09:34 -03:00
Chesars
d180db31e7 Use _get_httpx_client for HTTP polling in BFL image edit
Replace direct httpx.get() calls with _get_httpx_client() to reuse
cached HTTP client, following the pattern used by other providers
(RunwayML, Azure AI OCR, Sagemaker, etc.).
2026-03-04 18:09:12 -03:00
Chesars
77ca224a7f docs: add Black Forest Labs image edit documentation 2026-03-04 18:09:12 -03:00
Chesars
23bda9cc8e fix: remove unused Union import 2026-03-04 18:08:50 -03:00
Chesars
f132f2c811 chore: add Black Forest Labs models to model registry
Add BFL models to model_prices_and_context_window.json with pricing:
- flux-kontext-pro: $0.04/image
- flux-kontext-max: $0.08/image
- flux-pro-1.0-fill: $0.05/image
- flux-pro-1.0-expand: $0.05/image

Add black_forest_labs_models set to __init__.py for model discovery.
2026-03-04 18:08:50 -03:00
Chesars
cd731811d9 feat(black_forest_labs): add native image edit support for Black Forest Labs
Add native integration for Black Forest Labs image editing models
(flux-kontext-pro, flux-kontext-max, flux-pro-1.0-fill, flux-pro-1.0-expand).

Changes:
- Add BlackForestLabsImageEditConfig for BFL API transformation
- Add BLACK_FOREST_LABS to LlmProviders enum
- Add use_multipart_form_data() to BaseImageEditConfig for JSON vs form-data
- Modify image_edit_handler to support JSON request bodies
- Add comprehensive unit tests

Closes #11401
2026-03-04 18:08:50 -03:00
Cesar Garcia
bc10274928
Merge pull request #19518 from Chesars/fix-model-management-ui
Fix model management page UI improvements
2026-03-04 18:02:55 -03:00
Cesar Garcia
2e9326523a
Update ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/ModelsAndEndpointsView.test.tsx
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-04 18:01:28 -03:00
Cesar Garcia
424c433141
Merge pull request #22801 from Chesars/feat/mistral-audio-transcription
feat(mistral): add Voxtral audio transcription support
2026-03-04 17:55:33 -03:00
Cesar Garcia
0c2e6b5185
Merge pull request #22803 from Chesars/fix/reasoning-to-reasoning-content-delta
fix(streaming): map reasoning to reasoning_content in Delta for gpt-oss providers
2026-03-04 17:54:35 -03:00
Chesars
68cccc830d style(ui): fix indentation on TableRow props in all_models_table 2026-03-04 17:52:32 -03:00
Cesar Garcia
35b9ec3a86
Merge pull request #17662 from Chesars/fix/gemini-2x-media-resolution-detail-parameter
fix(gemini): support detail parameter for image resolution on Gemini 2.x models
2026-03-04 17:51:51 -03:00
Cesar Garcia
3a8fdc4b81
Update ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/components/AllModelsTab.tsx
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-04 17:50:55 -03:00
Chesars
e48b7ae8f9 fix(streaming): map reasoning to reasoning_content in Delta for gpt-oss providers
Providers like Cerebras return delta.reasoning in streaming responses
for gpt-oss models, but LiteLLM's Delta class expects reasoning_content.
This causes reasoning content to be silently dropped during streaming.

Fixes #13300
2026-03-04 17:44:30 -03:00
Chesars
18af581563 fix(ui): add missing onRowClick prop to AllModelsDataTable component
The AllModelsTab component was passing onRowClick to AllModelsDataTable
but the prop was not defined in the interface, causing the TypeScript
build to fail.
2026-03-04 17:42:51 -03:00
Chesars
c1a8bdd164 fix(gemini): support detail parameter for image resolution on Gemini 2.x models
Add global media_resolution support for Gemini 2.x models (2.0, 2.5) when
using OpenAI's detail parameter on images. Previously, the detail parameter
was only working for Gemini 3+ models (per-part) and was silently ignored
for older Gemini models.

- Add _get_highest_media_resolution() and _extract_max_media_resolution_from_messages()
  to extract highest detail from all images/files in a request
- Update _transform_request_body() to add mediaResolution to generationConfig
  for Gemini 2.x models only (not 1.x which doesn't support it, not 3+ which
  uses per-part)
- Add mediaResolution field to GenerationConfig TypedDict
- Support detail extraction from both image_url and file content types
- Add comprehensive unit tests and update documentation
2026-03-04 17:32:19 -03:00
Chesars
354f44c661 fix: serialize boolean provider params as lowercase strings
str(True) produces "True" but Mistral API expects lowercase "true".
Use str(value).lower() for bool params in provider-specific fields.
2026-03-04 16:56:51 -03:00
SebLz
2b91978b99
fix(responses): preserve query params in compact URL construction (#22668)
Co-authored-by: LIESLEN <sebastien.lentz@arcelormittal.com>
2026-03-04 11:33:13 -08:00
Chesars
c1d1f72f43 docs: add Mistral Voxtral audio transcription documentation
Add Mistral to the supported providers list in audio_transcription.md
and add Audio Transcription section to the Mistral provider page with
SDK usage, optional params, diarize support, and proxy configuration.
2026-03-04 16:26:53 -03:00
Chesars
086a58a06a feat(mistral): add Voxtral audio transcription support
Add MistralAudioTranscriptionConfig for Mistral's /v1/audio/transcriptions
endpoint, enabling litellm.transcription() with mistral/voxtral-mini-latest
and other Voxtral models. Supports multipart form-data with OpenAI-compatible
params (language, temperature, response_format, timestamp_granularities)
plus Mistral-specific params like diarize.
2026-03-04 16:20:05 -03:00
Miguel Armenta
750fc4a980
azure content enhancement... (#22581)
* azure content enhancement...

* rafactored to increase confidence score

* improvements based on additional feedback

* removed unused import

* Force-split any word longer than max length allowed

* preserve whitespace in text splitting

* moving common initialization to base class

* consolidate enforcement into async_make_request as single point, remove redundant caller-side checks, extract shared init/HTTP logic into base, and fix stale log messages

* clean up

* clean up tests
2026-03-04 10:22:30 -08:00
ryan-crabbe
0df36582de
Merge pull request #22728 from BerriAI/litellm_batch_expiry_validation_followup
fix(proxy): improve team expiry enforcement validation
2026-03-04 10:16:02 -08:00
Sameer Kankute
23d312dbd2
Merge pull request #22771 from BerriAI/litellm_responses_websocket_2
Add support for responses websocket for all providers
2026-03-04 22:12:12 +05:30
Milan
32b3874684 fix: update Okta SSO docs and custom SSO handler example
1. Okta SSO docs (admin_ui_sso.md):
   - Rewrite Step 3 to document both Org Auth Server (free) and
     Custom Auth Server (paid SKU) as tabbed options
   - Add Step 4 for GENERIC_CLIENT_STATE and PKCE configuration
     (moved from troubleshooting into the main guide)
   - Clarify no_matching_policy error only applies to Custom Auth Server
   - Deduplicate troubleshooting section to reference Step 4

2. Custom SSO handler (custom_sso.py + custom_sso.md):
   - Replace broken user_info() call with prisma_client.get_data()
   - user_info() is a FastAPI route handler requiring Request and
     UserAPIKeyAuth params, cannot be called directly
   - Keep new_user/add_new_member as commented-out import references
     in docs for customers who need them
2026-03-04 17:59:55 +02:00
Julio Quinteros Pro
edbb8ce360
Merge pull request #22775 from BerriAI/fix/model-prices-schema-new-properties
fix: add new model_prices properties to validation schema
2026-03-04 11:52:01 -03:00
Julio Quinteros Pro
53ea6a280a
Merge pull request #22776 from BerriAI/fix/ruff-unused-imports
fix: remove unused EncryptedContentAffinityCheck import in router.py
2026-03-04 11:51:11 -03:00
Julio Quinteros Pro
512a5fa3c7
Merge pull request #22788 from BerriAI/fix/azure-batches-add-tenacity-ci
Add tenacity to e2e Azure batch CI and revert importorskip
2026-03-04 11:50:44 -03:00