Skip to main content

StandardLoggingPayload Specification

Found under kwargs["standard_logging_object"]. This is a standard payload, logged for every successful and failed response.

StandardLoggingPayloadโ€‹

FieldTypeDescription
idstrUnique identifier
trace_idstrTrace multiple LLM calls belonging to same overall request
call_typestrType of call
response_costfloatCost of the response in USD ($)
response_cost_failure_debug_infoStandardLoggingModelCostFailureDebugInformationDebug information if cost tracking fails
statusStandardLoggingPayloadStatusStatus of the payload
total_tokensintTotal number of tokens
prompt_tokensintNumber of prompt tokens
completion_tokensintNumber of completion tokens
startTimefloatStart time of the call
endTimefloatEnd time of the call
completionStartTimefloatTime to first token for streaming requests
response_timefloatTotal response time. If streaming, this is the time to first token
model_map_informationStandardLoggingModelInformationModel mapping information
modelstrModel name sent in request
model_idOptional[str]Model ID of the deployment used
model_groupOptional[str]model_group used for the request
api_basestrLLM API base URL
metadataStandardLoggingMetadataMetadata information
cache_hitOptional[bool]Whether cache was hit
cache_keyOptional[str]Optional cache key
saved_cache_costfloatCost saved by cache
request_tagslistList of request tags
end_userOptional[str]Optional end user identifier
requester_ip_addressOptional[str]Optional requester IP address
messagesOptional[Union[str, list, dict]]Messages sent in the request
responseOptional[Union[str, list, dict]]LLM response
error_strOptional[str]Optional error string
error_informationOptional[StandardLoggingPayloadErrorInformation]Optional error information
model_parametersdictModel parameters
hidden_paramsStandardLoggingHiddenParamsHidden parameters

StandardLoggingUserAPIKeyMetadataโ€‹

FieldTypeDescription
user_api_key_hashOptional[str]Hash of the litellm virtual key
user_api_key_aliasOptional[str]Alias of the API key
user_api_key_org_idOptional[str]Organization ID associated with the key
user_api_key_team_idOptional[str]Team ID associated with the key
user_api_key_user_idOptional[str]User ID associated with the key
user_api_key_team_aliasOptional[str]Team alias associated with the key

StandardLoggingMetadataโ€‹

Inherits from StandardLoggingUserAPIKeyMetadata and adds:

FieldTypeDescription
spend_logs_metadataOptional[dict]Key-value pairs for spend logging
requester_ip_addressOptional[str]Requester's IP address
requester_metadataOptional[dict]Additional requester metadata
vector_store_request_metadataOptional[List[StandardLoggingVectorStoreRequest]]Vector store request metadata
requester_custom_headersDict[str, str]Any custom (x-) headers sent by the client to the proxy.
prompt_management_metadataOptional[StandardLoggingPromptManagementMetadata]Prompt management and versioning metadata
mcp_tool_call_metadataOptional[StandardLoggingMCPToolCall]MCP (Model Context Protocol) tool call information and cost tracking
applied_guardrailsOptional[List[str]]List of applied guardrail names
usage_objectOptional[dict]Raw usage object from the LLM provider
cold_storage_object_keyOptional[str]S3/GCS object key for cold storage retrieval
guardrail_informationOptional[StandardLoggingGuardrailInformation]Guardrail information

StandardLoggingVectorStoreRequestโ€‹

FieldTypeDescription
vector_store_idOptional[str]ID of the vector store
custom_llm_providerOptional[str]Custom LLM provider the vector store is associated with (e.g., bedrock, openai, anthropic)
queryOptional[str]Query to the vector store
vector_store_search_responseOptional[VectorStoreSearchResponse]OpenAI format vector store search response
start_timeOptional[float]Start time of the vector store request
end_timeOptional[float]End time of the vector store request

StandardLoggingAdditionalHeadersโ€‹

FieldTypeDescription
x_ratelimit_limit_requestsintRate limit for requests
x_ratelimit_limit_tokensintRate limit for tokens
x_ratelimit_remaining_requestsintRemaining requests in rate limit
x_ratelimit_remaining_tokensintRemaining tokens in rate limit

StandardLoggingHiddenParamsโ€‹

FieldTypeDescription
model_idOptional[str]Optional model ID
cache_keyOptional[str]Optional cache key
api_baseOptional[str]Optional API base URL
response_costOptional[str]Optional response cost
additional_headersOptional[StandardLoggingAdditionalHeaders]Additional headers
batch_modelsOptional[List[str]]Only set for Batches API. Lists the models used for cost calculation
litellm_model_nameOptional[str]Model name sent in request

StandardLoggingModelInformationโ€‹

FieldTypeDescription
model_map_keystrModel map key
model_map_valueOptional[ModelInfo]Optional model information

StandardLoggingModelCostFailureDebugInformationโ€‹

FieldTypeDescription
error_strstrError string
traceback_strstrTraceback string
modelstrModel name
cache_hitOptional[bool]Whether cache was hit
custom_llm_providerOptional[str]Optional custom LLM provider
base_modelOptional[str]Optional base model
call_typestrCall type
custom_pricingOptional[bool]Whether custom pricing was used

StandardLoggingPayloadErrorInformationโ€‹

FieldTypeDescription
error_codeOptional[str]Optional error code (eg. "429")
error_classOptional[str]Optional error class (eg. "RateLimitError")
llm_providerOptional[str]LLM provider that returned the error (eg. "openai")`

StandardLoggingPayloadStatusโ€‹

A literal type with two possible values:

  • "success"
  • "failure"

StandardLoggingGuardrailInformationโ€‹

FieldTypeDescription
guardrail_nameOptional[str]Guardrail name
guardrail_modeOptional[Union[GuardrailEventHooks, List[GuardrailEventHooks]]]Guardrail mode
guardrail_requestOptional[dict]Guardrail request
guardrail_responseOptional[Union[dict, str, List[dict]]]Guardrail response
guardrail_statusLiteral["success", "failure"]Guardrail status
start_timeOptional[float]Start time of the guardrail
end_timeOptional[float]End time of the guardrail
durationOptional[float]Duration of the guardrail in seconds
masked_entity_countOptional[Dict[str, int]]Count of masked entities

StandardLoggingPromptManagementMetadataโ€‹

Used for tracking prompt versioning and management information.

FieldTypeDescription
prompt_idstrRequired. Unique identifier for the prompt template or version
prompt_variablesOptional[dict]Variables/parameters used in the prompt template (e.g., {"user_name": "John", "context": "support"})
prompt_integrationstrRequired. Integration or system managing the prompt (e.g., "langfuse", "promptlayer", "custom")

StandardLoggingMCPToolCallโ€‹

Used to track Model Context Protocol (MCP) tool calls within LiteLLM requests. This provides detailed logging for external tool integrations.

FieldTypeDescription
namestrRequired. The name of the tool being called (e.g., "get_weather", "search_database")
argumentsdictRequired. Arguments passed to the tool as key-value pairs
resultOptional[dict]The response/result returned by the tool execution (populated by custom logging hooks)
mcp_server_nameOptional[str]Name of the MCP server that handled the tool call (e.g., "weather-service", "database-connector")
mcp_server_logo_urlOptional[str]URL for the MCP server's logo (used for UI display in LiteLLM dashboard)
namespaced_tool_nameOptional[str]Fully qualified tool name including server prefix (e.g., "deepwiki-mcp/get_page_content", "github-mcp/create_issue")
mcp_server_cost_infoOptional[MCPServerCostInfo]Cost tracking information for the tool call

MCPServerCostInfoโ€‹

Cost tracking structure for MCP server tool calls:

FieldTypeDescription
default_cost_per_queryOptional[float]Default cost in USD for any tool call to this MCP server
tool_name_to_cost_per_queryOptional[Dict[str, float]]Per-tool cost mapping for granular pricing (e.g., {"search": 0.01, "create": 0.05})

Usageโ€‹

# Basic MCP tool call metadata
mcp_tool_call = {
"name": "search_documents",
"arguments": {
"query": "machine learning tutorials",
"limit": 10,
"filter": "type:pdf"
},
"mcp_server_name": "document-search-service",
"namespaced_tool_name": "docs-mcp/search_documents",
"mcp_server_cost_info": {
"default_cost_per_query": 0.02,
"tool_name_to_cost_per_query": {
"search_documents": 0.02,
"get_document": 0.01
}
}
}

# optional result field (via custom logging hooks)
mcp_tool_call_with_result = {
"name": "search_documents",
"arguments": {
"query": "machine learning tutorials",
"limit": 10,
"filter": "type:pdf"
},
"result": {
"documents": [...],
"total_found": 42,
"search_time_ms": 150
},
"mcp_server_name": "document-search-service",
"namespaced_tool_name": "docs-mcp/search_documents",
"mcp_server_cost_info": {
"default_cost_per_query": 0.02,
"tool_name_to_cost_per_query": {
"search_documents": 0.02,
"get_document": 0.01
}
}
}