litellm/tests/integration/spend
zoveki ff182c194e
fix(logging): keep the caller's call_type when chat completions are bridged to the Responses API (#49710)
* fix(logging): keep the caller's call_type when chat completions are bridged to the Responses API

* fix(logging): log bridged chat completions with the chat response they returned

* fix(logging): log bridged text completions and /v1/messages as served, with the request's options

Bridged rows were translated without the request's options, so structured
output and replay fields could differ from what the client got. Text
completions and non-streamed /v1/messages through the chat bridge also kept
a Responses API object or the encoded id.

* fix(logging): redact reasoning summaries on bridged rows and log bridged text completions as text completions

Redaction now drops reasoning_items on chat messages and deltas, so a bridged row keeps no reasoning summary when message logging is off. A non-streamed bridged text completion logs the text completion the client got, priced like the chat response it came from. The bridge handler's input TypedDict fields are ReadOnly.

* fix(logging): redact bridged text completions for opted-out callbacks and pin the sync logged shape and usage ack

* test(integration): look up bridged chat spend rows by the id the client got

Bridged chat spend rows are keyed by the client-facing id and logged with the caller's call type, so the helpers that decoded the old resp_<base64> key or pinned call_type responses now assert the new contract

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-03 10:02:54 +00:00
..
fixtures
golden
__init__.py
_background_responses.py
_daily_activity_fixtures.py
_partial_stream.py
test_agent_spend.py
test_autorouter_session_rollup.py
test_background_interaction_settlement.py
test_background_response_billed_once.py
test_background_response_billing_proxies.py
test_background_response_poll_retirement.py
test_baggage_tag_mappings.py
test_baseline_accounting.py
test_batch_completion_accounting.py
test_batch_enqueued_tokens_redis_lua.py
test_batch_observability.py
test_batch_poll_starvation.py
test_budget_limit_envelopes.py
test_cache_activity.py
test_cache_and_quota.py
test_chaos_burst_spend_once.py
test_chatgpt_subscription_usage.py
test_container_spend.py
test_daily_activity_aggregated_breakdowns.py
test_daily_activity_key_alias_probes.py
test_daily_activity_key_metadata_query_timeout.py
test_daily_activity_key_owner.py
test_daily_activity_key_owner_faults.py
test_daily_activity_key_owner_traffic.py
test_daily_activity_repository.py
test_daily_activity_routes.py
test_daily_rollup_retry.py
test_daily_tag_spend_retention.py
test_disable_end_user_cost_tracking.py
test_disconnected_bedrock_messages_stream_billing.py
test_end_user_budget_enforcement.py fix(anthropic_endpoints)!: return Anthropic error envelopes on /v1/messages auth failures (#48466) 2026-11-03 01:53:29 +00:00
test_end_user_spend_without_proxy_user.py fix(anthropic_endpoints)!: return Anthropic error envelopes on /v1/messages auth failures (#48466) 2026-11-03 01:53:29 +00:00
test_expired_ui_session_failure_rows.py
test_failed_dispatch_tokens.py
test_failure_spend_live_counters_chaos.py
test_filtered_ledger.py
test_gemini_tts_speech_billing.py
test_global_proxy_spend_counter.py
test_global_spend_report.py
test_global_spend_reset.py
test_google_genai_native_spend.py
test_image_generation_key_spend.py
test_key_budget_lockout.py
test_key_metadata_recovery_dropped_connection.py
test_key_metadata_recovery_probe_bounds.py
test_legacy_spend_logs_row_cap.py
test_messages_stream_usage_cost.py
test_model_router_selected_model.py
test_non_finite_cost_spend_writes.py
test_normalized_error_long_message.py test(integration): repair release qualification timing and labels (#49737) 2026-11-02 18:02:28 -08:00
test_openrouter_upstream_provider.py
test_org_budget_cli_session_token.py
test_partial_stream_live_budget.py test(spend): assert Anthropic envelope for Messages budget refusals (#49800) 2026-11-03 06:10:08 +00:00
test_passthrough_budget_reservation.py
test_passthrough_request_tags.py
test_passthrough_stream_pricing_paths_spend.py
test_passthrough_upstream_model.py
test_prompt_caching_requests_pagination.py
test_ptu_share_attribution.py
test_redis_ttl_preserving_token_increment.py
test_requester_ip_address_logging.py
test_reset_budget_leader_election.py
test_responses_bridge_spend_once.py fix(logging): keep the caller's call_type when chat completions are bridged to the Responses API (#49710) 2026-11-03 10:02:54 +00:00
test_responses_cache_write_itemization.py
test_responses_stream_spend_row_id.py fix(spend)!: save streamed /v1/responses spend rows under the encrypted resp_ id the client received (#49493) 2026-11-02 14:13:17 -08:00
test_responses_websocket_turn_rows.py
test_roi_branch_spend.py
test_router_cooldown_failure_row.py
test_scoped_spend_reports.py
test_service_tier_stream_billing.py
test_session_total_spend.py
test_shutdown_flush.py
test_spend_attribution_contracts.py
test_spend_calculate.py
test_spend_capture_rate_captured_spend.py
test_spend_log_caller_session.py
test_spend_log_read_scope.py
test_spend_log_tool_payload_content.py
test_spend_log_write_batching.py
test_spend_logs_metadata_fields.py
test_spend_rollup_accuracy.py
test_stream_alias_billing.py
test_streamed_usage_estimate.py
test_tag_budget_enforcement.py
test_team_budget_enforcement.py
test_team_daily_activity_aggregated.py
test_team_member_budget_alerts.py
test_team_member_spend.py
test_team_member_spend_flush.py
test_team_member_total_spend_reconciliation.py
test_text_completion_stream_usage_cost.py
test_unmanaged_vertex_batch_deployment_routing_wire.py
test_user_budget_on_team_keys.py
test_vertex_image_regional_uplift.py
test_vertex_passthrough_regional_uplift_spend.py
test_vertex_regional_uplift_spend.py