mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* feat(ui): show the usage spend total in another currency at ECB reference rates Adds GET /get/reference_exchange_rates, which returns the current ECB reference rates as USD per unit for every feed currency. It refreshes at most once a day under a lock, keeps fresh rates when a refresh fails and answers 503 instead of serving rates older than seven days. The usage overview's spend card gets a Spend display selector. It asks for rates only once opened and then shows an estimated amount with the rate date under the unchanged USD total. Every other figure stays in USD. * fix(ui): fall back to USD when spend display rates stop being usable The selector now shows USD whenever no estimate can be shown, so a failed refetch never leaves EUR selected beside a USD-only notice, and an opened selector refreshes its rates hourly. The endpoint gets its HTTP client inside the async fetch so the client belongs to the serving event loop. * fix(proxy): import the ECB rates endpoint HTTP client helper at module level Binds get_async_httpx_client at import so its type is known. The client is still built inside the awaited fetch on the serving event loop. * fix(proxy): fetch display rates with a short-lived handler closed after each refresh Builds an AsyncHTTPHandler inside the refresh fetch and closes it when the fetch ends, and drops the descriptive comment on the spend display component. * chore(ui): regenerate API types for the reference exchange rates endpoint * fix(proxy): use the cached async client factory for display rate refreshes Direct AsyncHTTPHandler construction fails the async client check, so the refresh fetch goes back to get_async_httpx_client, called inside the awaited fetch, with a named type suppression for the factory's untyped params. * fix(ui): tidy spend display helper, hook options and fallback test Groups the rate snapshot into one estimatedSpend argument, names the rates query options, names the missing-estimate condition, and waits for the unavailable notice before asserting the USD fallback. * chore(ui): drop a restating comment on the spend estimate helper * test(proxy): prove concurrent first rate requests share one ECB fetch * fix(proxy): wait a minute before retrying a failed display rate refresh A failed ECB refresh left rates due, so every request after it waited on the lock and fetched again, and N queued callers paid N timeouts during an outage. The endpoint now skips refreshing for 60 seconds after a failed attempt, serving held rates or a 503, and retries on the first request after that. Concurrent waiters share the failed attempt. Also drops the usd_rates docstring. * fix(ui): retry unavailable currency estimates on reopen * refactor(ui): name the currency selector open handler * style(ui): format currency selector props --------- Co-authored-by: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| audio_utils | ||
| llm_cost_calc | ||
| llm_response_utils | ||
| prompt_templates | ||
| specialty_caches | ||
| __init__.py | ||
| attribute_forwarder.py | ||
| conftest.py | ||
| event_loop_lag.py | ||
| fake_secret_vault.py | ||
| messages_with_counts.py | ||
| test_agentic_followup_kwargs.py | ||
| test_allowed_tools_tool_choice.py | ||
| test_anthropic_dedup_factory.py | ||
| test_api_route_to_call_types.py | ||
| test_app_crypto.py | ||
| test_audio_utils.py | ||
| test_aws_partition.py | ||
| test_batch_utils.py | ||
| test_bedrock_converse_dedup_factory.py | ||
| test_bug_report.py | ||
| test_chat_completion_agentic_loop.py | ||
| test_classifier_logging.py | ||
| test_cli_token_utils.py | ||
| test_cloud_storage_security.py | ||
| test_codestral_provider_routing.py | ||
| test_core_helpers.py | ||
| test_coroutine_checker.py | ||
| test_cost_discount.py | ||
| test_custom_logger_registry.py | ||
| test_dd_tracing.py | ||
| test_decisions_pricing.py | ||
| test_decode_special_tokens.py | ||
| test_default_encoding.py | ||
| test_dot_notation_indexing.py | ||
| test_duration_parser.py | ||
| test_ecb_reference_rates.py | ||
| test_env_utils.py | ||
| test_error_normalization.py | ||
| test_exception_mapping_utils.py | ||
| test_extract_base64_image.py | ||
| test_fallback_generalizations.py | ||
| test_fallback_utils.py | ||
| test_get_litellm_params.py | ||
| test_get_llm_provider_endpoint_match.py | ||
| test_get_llm_provider_logic.py | ||
| test_get_model_cost_map.py | ||
| test_get_supported_openai_params.py | ||
| test_health_check_helpers.py | ||
| test_hidden_params.py | ||
| test_image_handling.py | ||
| test_initialize_dynamic_callback_params.py | ||
| test_internal_call_metadata.py | ||
| test_json_fragment_accumulator.py | ||
| test_json_schema_validation.py | ||
| test_litellm_logging.py | ||
| test_llm_judge.py | ||
| test_llm_request_utils.py | ||
| test_logging_callback_manager.py | ||
| test_logging_utils.py | ||
| test_logging_worker.py | ||
| test_max_streaming_duration.py | ||
| test_model_cost_table.py | ||
| test_model_latest_aliases.py | ||
| test_model_param_helper.py | ||
| test_model_response_utils.py | ||
| test_moderation_standard_logging.py | ||
| test_oauth_token_exchange.py | ||
| test_offline_mode.py | ||
| test_optional_imports.py | ||
| test_path_utils.py | ||
| test_private_json.py | ||
| test_provider_affinity.py | ||
| test_provider_specific_headers.py | ||
| test_ptu_pricing.py | ||
| test_realtime_errors.py | ||
| test_realtime_guardrails.py | ||
| test_realtime_streaming.py | ||
| test_redact_messages.py | ||
| test_request_timeout_resolver.py | ||
| test_retry_after_headers.py | ||
| test_safe_divide_seconds.py | ||
| test_safe_json_dumps.py | ||
| test_sensitive_data_masker.py | ||
| test_sentry_scrubbing.py | ||
| test_served_output_texts.py | ||
| test_stream_usage_logging.py | ||
| test_streaming_chunk_builder_cursor.py | ||
| test_streaming_chunk_builder_server_tool_use.py | ||
| test_streaming_chunk_builder_utils.py | ||
| test_streaming_handler.py | ||
| test_streaming_overhead.py | ||
| test_text_completion_conversion.py | ||
| test_thread_pool_executor.py | ||
| test_token_counter.py | ||
| test_token_counter_tool.py | ||
| test_token_counter_tool_data.py | ||
| test_tokenizer.py | ||
| test_tool_fields.py | ||
| test_tool_search_spend_logging.py | ||
| test_total_deadline.py | ||
| test_url_utils.py | ||
| test_xai_oauth_routing.py | ||
| weakly_parked_logger.py | ||