mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-30 01:08:33 +00:00
* feat(rust-config): add repositories for the config, model and credential tables Typed reads of LiteLLM_Config by param name, and of every LiteLLM_ProxyModelTable and LiteLLM_CredentialsTable row, for the gateway to load its DB config from. Model and credential reads prefer the writer and fall back to the replica only while the writer is down, like Python's WriterPinnedClient. * feat(rust-config): layer LiteLLM_Config settings rows over the config document * feat(rust-gateway): hold config-built state in a swappable unit Both gateway modes now serve from Live, which holds the AppState, the Admit built over it and the native app as one Served and replaces them together. An admitted request carries the Served that admitted it, so a swap never splits a request across two configs. Nothing swaps outside tests yet. * feat(rust-config): merge DB models and credentials into the config model list Adds litellm_config::db::models::merge, a pure function that adds decrypted LiteLLM_ProxyModelTable rows to the config document's model_list the way Python's reconcile upserts them, and fills each litellm_credential_name from the file's credential_list and decrypted LiteLLM_CredentialsTable rows. It runs on the document before os.environ/ resolution. Nothing calls it yet. * feat(rust-config): add litellm-at-rest crate for salt-key encryption of DB values Ports the non-FIPS paths of encrypt_decrypt_utils.py. Decrypt detects the v2:gcm: AES-256-GCM format and falls back to the legacy NaCl SecretBox format, encrypt writes either, and decrypt_or_original mirrors decrypt_value_helper(return_original_value=True). Fixtures captured once from Python pin both directions. * feat(rust-config): load a config document in steps so DB rows can be layered in * feat(rust-gateway): boot from the config file plus the config stored in the DB * fix(rust-gateway): honor the default-off flags /model/new stores with every model * feat(rust-gateway): read the config stored in the DB again on an interval and swap to it A poller in both modes reads the stored settings rows, models and credentials every proxy_config_reload_interval_seconds, logs what changed by model id, credential and settings key, and swaps the served state when the decrypted rows changed. Python's guards hold: a failed model or credential read changes nothing, a failed settings read removes no model. The first read that loads lifts db_config_not_loaded. AppState::next rebuilds only the config-derived parts over the Redis clients, DB pools, HTTP pool, license, routing cache and limiter counters the process keeps. * feat(rust-gateway): read the stored config again when the proxy announces a change on Redis * fix(rust-gateway): box the poll's reload so release builds stay under the layout query depth * fix(rust-gateway): honor general_settings.encryption_algorithm in admit Python reads it only when it writes an encrypted value, and the at-rest crate detects the format of each value it reads. * feat(rust-gateway): warn when a stored boot-only setting changes, read PROXY_CONFIG_RELOAD_INTERVAL_SECONDS Each read of the stored config names the stored settings the kept Redis clients and database pools are built from that differ from boot, since applying them takes a restart. The reload interval falls back to PROXY_CONFIG_RELOAD_INTERVAL_SECONDS when the config leaves it unset, as in Python. * feat(rust-config): add a repository for the LiteLLM_UISettings row The proxy merges eleven runtime flags from this row into general_settings, forward_client_headers_to_llm_api among them, so the gateway needs to read it next to the LiteLLM_Config rows. * fix(rust-at-rest): zero the derived key when it is dropped * feat(rust-config): layer the LiteLLM_UISettings flags into general_settings, and fail a Python test when the copied key lists drift The proxy copies eleven runtime flags from the LiteLLM_UISettings row into general_settings, forward_client_headers_to_llm_api among them. The overlay now takes that row as UiSettings and applies the flags under the file, as sync_ui_settings_to_general_settings does, pinned by new Python-captured cases. A unit test in tests/unit/proxy/test_proxy_server.py compares Python's live key lists with the tables the Rust overlay copies, so adding or removing a key on the Python side fails CI until the fixture and keys.rs are regenerated. * fix(rust-gateway): use arc-swap 1.9.5 * fix(rust-config): read os.environ/ in a stored model row only where Python does A stored row was merged into the document before the config-load walk, which reads os.environ/ references anywhere. Python reads them only in top-level litellm_params strings (_resolve_db_litellm_param), so a team model named os.environ/LITELLM_MASTER_KEY got the master key resolved into the merged config. merge now takes a ResolvedModel, made by DbModel::resolve with exactly Python's scope, and expects the file document already resolved. Stored credential values stay literal, as in Python. * fix(rust-config): add the general_settings keys main added since the overlay branched Merging main brought eight new ConfigGeneralSettings fields, which the new drift test caught in CI. Regenerated db_settings.json and copied the keys into keys.rs. * feat(rust-gateway): layer the UI settings flags in at boot and read stored model references only where Python does Boot now reads the LiteLLM_UISettings row next to the LiteLLM_Config rows and passes it to the settings overlay, whenever the gateway has a database, as the proxy syncs it at startup with or without store_model_in_db. A flag set only through the UI, such as forward_client_headers_to_llm_api, now reaches admit, which sends those requests to Python. A UI settings row that cannot be read leaves every request to Python. Stored models are merged after the file's os.environ/ walk, through Document::resolve_with_stored, so each row reads only its top-level litellm_params references like _resolve_db_litellm_param and stored credential values stay literal. * feat(rust-config): let a caller read the UI settings it was given The gateway's reload compares two reads of the stored config key by key, so it needs the settings a UiSettings holds. * style(rust-gateway): format after merging the boot branch * fix(rust-gateway): build after merging the poll branch's UI settings read Drops the rand dependency the merge listed twice and gives the slow test rows the new ui_settings read. * fix(rust-config): fill a credential's oidc/ api_key only for models on the credential's own origins Python binds a stored credential's oidc/ api_key to the origins of the credential's upstream params (CredentialApiKeySecretReference) and refuses a call that points elsewhere. The merge copied the key in as a plain param, so a model with its own api_base would have carried it there. Now the key is left out for such a model and reported in Merged::withheld_secrets, using Python's origin rule (scheme, host and port with the default port filled in, every upstream param plus a URL in model, and a credential without any upstream only for a model without one). * feat(rust-at-rest): derive the key with KBKDF in fips_mode and compile out XSalsa20 under fips AtRestKey::derive takes a KeyDerivation. FipsKbkdf matches Python's _fips_at_rest_key byte for byte (SP 800-108 counter-mode HMAC-SHA256 with OpenSSL's default layout), refuses a salt key under 14 bytes, and reads and writes only v2:gcm: values. The fips feature compiles XSalsa20 out, and crypto_secretbox now comes from a default xsalsa20 feature. SHA-256, HMAC, KBKDF and AES-256-GCM sit behind one private module so a FIPS build can move them onto a validated module later. NotCiphertext and TooLong no longer carry the RustCrypto aead::Error, which held no information. The fips_mode fixtures come from Python's own code run on OpenSSL's default provider, with every KBKDF output checked against cryptography's KBKDFHMAC. * feat(rust-gateway): warn about a model its credential's oidc/ api_key may not reach G4 now leaves such a key out. The gateway logs each such model and a test pins that admit sends it to Python. * fix(rust-at-rest): fail closed under the fips feature until a validated module is wired in Under `fips` every operation in the approved.rs seam (SHA-256 and KBKDF key derivation, AES-256-GCM seal with its nonce, and open) returns NoValidatedBackend instead of running RustCrypto, so that build reads and writes nothing. In the default build FipsKbkdf stays as format compatibility with values Python wrote in fips_mode. AtRestKey::from_salt_key is gone because key derivation can now fail. AtRestKey::derive returns KeyError, which replaces SaltKeyTooShort. * feat(rust-config): read general_settings.fips_mode as the proxy does FipsMode::of reads it like fips_mode_setting: absent is off, a bool as written, text through str_to_bool, anything else is not a boolean, which the proxy refuses to boot with. It is no ConfigGeneralSettings field, so a stored row cannot set it, and a test pins that. * feat(rust-gateway): decrypt the stored config with the fips_mode key when fips_mode is on With general_settings.fips_mode on, the at-rest key is the KBKDF key of LITELLM_SALT_KEY alone, as in Python. A fips_mode that is not a boolean, a missing or short salt key, or a build with no validated backend leaves the stored config unread, so every request goes to Python. It never falls back to the SHA-256 key. * test(rust-gateway): a model blocked through the API goes to Python after the next read /model/block writes LiteLLM_ProxyModelTable.blocked and publishes a config change, so the poll and the Redis listener both read it again. Pins that the reload swaps to a config whose admit sends the blocked model to Python, and back once unblocked. * fix(rust-gateway): keep a UI settings read failure apart from the stored config being unread With store_model_in_db off, a UI settings row that cannot be read gave StoredConfig::Unread, which means store_model_in_db is on and the stored config did not read. Boot now decides store_model_in_db first and gives UiSettingsUnread in that case, so nothing later treats it as a stored config to read again. Admit still sends every request to Python for it. * fix(rust-gateway): leave every request to Python when the stored settings rows cannot be read at boot The stored general_settings row can turn store_model_in_db on, and it can carry settings such as allowed_ips or custom_auth that Python then enforces. When it cannot be read the switch is unknown, so boot now treats the stored config as unread instead of as off, and admit sends every request to Python. * fix(rust-config): treat a null upstream param as unset when binding a credential's oidc key with_credential fills a null param from the credential, and Python's router drops nulls before the call, so the credential's own api_base is where the key goes. * fix(rust-gateway): mark UI settings that do not layer in as unread UI settings, not an unread stored config With store_model_in_db off nothing else is stored, so admit should name ui_settings and nothing should poll the stored config. * style(rust-gateway): rewrap the ui_settings_unread doc comment * fix(rust-gateway): stop polling and blame ui_settings when a poll finds store_model_in_db off and the UI settings do not load Boot already marks that case UiSettingsUnread; a poll that learns store_model_in_db is off now does the same instead of keeping the Unread state and polling forever. * fix(rust-gateway): read the key limiter window and admit's variables through the config's environment_variables Python exports file and stored environment_variables into os.environ before its limiter reads LITELLM_RATE_LIMIT_WINDOW_SIZE on each call, so the gateway now reads them through the layered lookup too. Readers Python runs before it loads its config keep the process environment. * fix(rust-gateway): rebuild the layered variables on every swap so a stored environment variable change reaches the key limiter --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| _experimental | ||
| a2a | ||
| agent_endpoints | ||
| alerting_endpoints | ||
| analytics_endpoints | ||
| anthropic_endpoints | ||
| auth | ||
| batches_endpoints | ||
| client | ||
| common_utils | ||
| config_resolvers | ||
| container_endpoints | ||
| control_plane | ||
| credential_endpoints | ||
| db | ||
| decisions_endpoints | ||
| deps | ||
| discovery_endpoints | ||
| enterprise_billing | ||
| example_config_yaml | ||
| fine_tuning_endpoints | ||
| google_endpoints | ||
| guardrails | ||
| health_endpoints | ||
| hooks | ||
| image_endpoints | ||
| list_api | ||
| logging_endpoints | ||
| management | ||
| management_endpoints | ||
| management_helpers | ||
| mcp_server | ||
| memory | ||
| middleware | ||
| ocr_endpoints | ||
| openai_files_endpoint | ||
| pass_through_endpoints | ||
| policy_engine | ||
| prompts | ||
| proxy_server | ||
| public_endpoints | ||
| rag_endpoints | ||
| realtime_endpoints | ||
| rerank_endpoints | ||
| response_api_endpoints | ||
| response_polling | ||
| roi_calculator | ||
| rust_forward | ||
| search_endpoints | ||
| shutdown | ||
| spend_tracking | ||
| telemetry | ||
| test_configs | ||
| types_utils | ||
| ui_crud_endpoints | ||
| utils | ||
| vector_store_endpoints | ||
| vector_store_files_endpoints | ||
| video_endpoints | ||
| __init__.py | ||
| _prisma.py | ||
| conftest.py | ||
| proxy_server_config.yaml | ||
| router_entry_point_stubs.py | ||
| rust_auth_stores.py | ||
| skill_submission_rows.py | ||
| spend_counters_ledger_twin.py | ||
| test__lazy_features.py | ||
| test__types.py | ||
| test_admin_mcp.py | ||
| test_aiohttp_cleanup_closed.py | ||
| test_aiohttp_session_recovery.py | ||
| test_api_key_masking_in_errors.py | ||
| test_aproxy_startup.py | ||
| test_audio_speech_prometheus_hooks.py | ||
| test_batch_expiry.py | ||
| test_batch_metadata_none_fix.py | ||
| test_batch_retrieve_bedrock.py | ||
| test_batch_x_litellm_model_encoding.py | ||
| test_blocked_response_usage.py | ||
| test_body_snapshot_callback_params.py | ||
| test_budget_reservation.py | ||
| test_budget_reservation_ledger.py | ||
| test_budget_reservation_rust.py | ||
| test_budget_reservation_rust_ledger.py | ||
| test_bug_report_config.py | ||
| test_caching_routes.py | ||
| test_chat_completion_metadata.py | ||
| test_claude_code_marketplace.py | ||
| test_collector.py | ||
| test_common_request_processing.py | ||
| test_component_allowlists.py | ||
| test_conftest.py | ||
| test_cors_config.py | ||
| test_credential_slot_registry.py | ||
| test_custom_callback_input.py | ||
| test_custom_logger_s3_gcs.py | ||
| test_custom_proxy.py | ||
| test_custom_tokenizer_bug.py | ||
| test_db_schema_changes.py | ||
| test_dev_reload.py | ||
| test_dynamic_mcp_route.py | ||
| test_empty_model_list.py | ||
| test_enforce_user_param.py | ||
| test_fallback_management_endpoints.py | ||
| test_fastapi_offline_routes.py | ||
| test_filter_models_by_team_access_group.py | ||
| test_get_favicon.py | ||
| test_get_image.py | ||
| test_health_check_functions.py | ||
| test_health_check_max_tokens.py | ||
| test_init_litellm_callbacks.py | ||
| test_langfuse_passthrough_security.py | ||
| test_lazy_openapi_snapshot.py | ||
| test_litellm_pre_call_utils.py | ||
| test_max_budget_env_var.py | ||
| test_mcp_asgi_response.py | ||
| test_model_based_routing_files_batches.py | ||
| test_model_deprecations_endpoint.py | ||
| test_model_dump_with_preserved_fields.py | ||
| test_model_id_header_propagation.py | ||
| test_model_info_default_limits.py | ||
| test_model_level_guardrails.py | ||
| test_model_list_aliases.py | ||
| test_model_list_callback_filter.py | ||
| test_model_list_discoverable.py | ||
| test_model_list_healthy_only.py | ||
| test_modify_response_streaming_passthrough.py | ||
| test_moyai_endpoints.py | ||
| test_native_compaction.py | ||
| test_openai_ws_passthrough_routes.py | ||
| test_openapi_schema_validation.py | ||
| test_plugin_routes.py | ||
| test_pointfive_dashboard_config.py | ||
| test_pointfive_ui_callback.py | ||
| test_pricing_currency.py | ||
| test_pricing_field_strip.py | ||
| test_prisma_client_backoff_retry.py | ||
| test_prisma_engine_watchdog.py | ||
| test_prisma_migration.py | ||
| test_prometheus_cleanup.py | ||
| test_prometheus_metrics_server.py | ||
| test_prompt_test_endpoint.py | ||
| test_provider_url_destination_guard.py | ||
| test_proxy_cli.py | ||
| test_proxy_config_unit_test.py | ||
| test_proxy_custom_auth.py | ||
| test_proxy_logging_hook_detection.py | ||
| test_proxy_reject_logging.py | ||
| test_proxy_server.py | ||
| test_proxy_server_custom_logger.py | ||
| test_proxy_server_endpoints_and_startup.py | ||
| test_proxy_server_endpoints_and_startup_ledger.py | ||
| test_proxy_server_exception_mapping.py | ||
| test_proxy_setting_guardrails.py | ||
| test_proxy_token_counter.py | ||
| test_proxy_types.py | ||
| test_proxy_utils.py | ||
| test_proxy_utils_model_creation_and_error_logging.py | ||
| test_pyroscope.py | ||
| test_read_model_list.py | ||
| test_redis_auth_cache_flag.py | ||
| test_reducto_ocr_route.py | ||
| test_response_model_sanitization.py | ||
| test_response_polling_pre_call_checks.py | ||
| test_route_a2a_models.py | ||
| test_route_llm_request.py | ||
| test_route_priority.py | ||
| test_sensitive_route_auth.py | ||
| test_server_listener.py | ||
| test_server_root_path.py | ||
| test_shared_health_check.py | ||
| test_spend_log_cleanup.py | ||
| test_swagger_chat_completions.py | ||
| test_team_member_update.py | ||
| test_team_org_move.py | ||
| test_tools_allowlist_enforcement.py | ||
| test_ui_path_detection.py | ||
| test_unit_test_proxy_hooks.py | ||
| test_update_llm_router_resilience.py | ||
| test_update_spend.py | ||
| test_v2_hook_routing.py | ||
| test_v2_proxy_fields.py | ||
| test_zero_cost_model_budget_bypass.py | ||
| test_zerobus_dashboard_config.py | ||
| vector_store_access_group_state.py | ||
| vertex_key.json | ||