Skip to main content

FOCUS Format Export

LiteLLM supports exporting cost and usage data in FOCUS (FinOps Open Cost & Usage Specification) format, an open specification for consistent cost and usage datasets from the FinOps Foundation.

Overview

PropertyDetails
DescriptionExport LiteLLM usage data in FOCUS format for FinOps tools
Supported Operations• JSON export
• CSV export
• Dry run testing
Data FormatFOCUS 1.0 specification compliant
Compatible ToolsAPTIO, CloudHealth, Apptio Cloudability, and other FinOps tools

What is FOCUS?

FOCUS (FinOps Open Cost & Usage Specification) is an open specification developed by the FinOps Foundation to standardize cloud cost and usage data. It provides a common schema that enables:

  • Consistent cost reporting across multiple cloud providers and services
  • Easy integration with FinOps tools and platforms
  • Simplified cost allocation and chargeback processes
  • Better visibility into AI/LLM spending

Learn more at focus.finops.org

Setup

Prerequisites

  • LiteLLM Proxy with a connected database
  • Admin API key for authentication

No additional environment variables are required for FOCUS export.

Optional Environment Variables

VariableRequiredDescriptionDefault
FOCUS_EXPORT_TIMEZONENoTimezone for date handlingUTC

API Endpoints

Export as JSON

Export usage data in FOCUS format as JSON:

curl -X POST "http://localhost:4000/focus/export" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
-d '{
"limit": 1000,
"include_tags": true,
"include_token_breakdown": true
}' | jq

Request Parameters:

ParameterTypeDescriptionDefault
limitintegerMaximum records to exportNo limit
start_time_utcdatetimeStart time filter (ISO format)None
end_time_utcdatetimeEnd time filter (ISO format)None
include_tagsbooleanInclude resource tagstrue
include_token_breakdownbooleanInclude token breakdown in tagstrue

Example Response:

{
"message": "FOCUS export completed successfully",
"status": "success",
"format": "json",
"data": {
"focus_version": "1.0",
"export_timestamp": "2024-01-15T14:30:00Z",
"record_count": 100,
"records": [
{
"BilledCost": 0.002,
"BillingPeriodStart": "2024-01-15T00:00:00",
"BillingPeriodEnd": "2024-01-16T00:00:00",
"ChargeCategory": "Usage",
"ChargeClass": "Standard",
"ChargeDescription": "LLM inference using gpt-4o via openai",
"ConsumedQuantity": 150,
"ConsumedUnit": "Tokens",
"EffectiveCost": 0.002,
"ListCost": 0.002,
"ProviderName": "OpenAI",
"PublisherName": "LiteLLM",
"ResourceId": "litellm/openai/team-123/gpt-4o",
"ResourceName": "gpt-4o",
"ResourceType": "LLM",
"ServiceCategory": "AI and Machine Learning",
"ServiceName": "LLM Inference",
"SubAccountId": "team-123",
"SubAccountName": "Engineering Team",
"Tags": {
"litellm:provider": "openai",
"litellm:model": "gpt-4o",
"litellm:prompt_tokens": "100",
"litellm:completion_tokens": "50"
}
}
]
},
"summary": {
"total_records": 100,
"total_billed_cost": 0.50,
"total_consumed_quantity": 50000,
"unique_providers": 3,
"unique_sub_accounts": 5
}
}

Export as CSV

Export usage data in FOCUS format as CSV:

curl -X POST "http://localhost:4000/focus/export/csv" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
-d '{
"limit": 1000
}' -o focus_export.csv

The CSV export is ideal for importing into spreadsheets or FinOps tools that accept CSV data.

Dry Run Export

Test the export without committing any changes:

curl -X POST "http://localhost:4000/focus/dry-run" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
-d '{
"limit": 100
}' | jq

Example Response:

{
"message": "FOCUS dry run export completed successfully",
"status": "success",
"raw_data_sample": [...],
"focus_data": [...],
"summary": {
"total_records": 100,
"total_billed_cost": 0.50,
"total_consumed_quantity": 50000,
"unique_providers": 3,
"unique_sub_accounts": 5
}
}

Get Schema Information

Get documentation about the FOCUS columns:

curl "http://localhost:4000/focus/schema" \
-H "Authorization: Bearer sk-1234" | jq

FOCUS Columns

Required Columns

ColumnDescriptionExample
BilledCostThe cost that is invoiced/billed0.002
BillingPeriodStartStart of billing period2024-01-15T00:00:00
BillingPeriodEndEnd of billing period2024-01-16T00:00:00
ColumnDescriptionExample
ChargeCategoryType of chargeUsage
ChargeClassClassification of chargeStandard
ChargeDescriptionHuman-readable descriptionLLM inference using gpt-4o
ChargePeriodStartStart of charge period2024-01-15T00:00:00
ChargePeriodEndEnd of charge period2024-01-16T00:00:00
ConsumedQuantityAmount consumed (tokens)150
ConsumedUnitUnit of consumptionTokens
EffectiveCostCost after discounts0.002
ListCostCost at list prices0.002
ProviderNameLLM provider nameOpenAI
PublisherNamePublisher nameLiteLLM
RegionGeographic region (if applicable)us-east-1
ResourceIdUnique resource identifierlitellm/openai/team-123/gpt-4o
ResourceNameModel namegpt-4o
ResourceTypeType of resourceLLM
ServiceCategoryService categoryAI and Machine Learning
ServiceNameService nameLLM Inference
SubAccountIdSub-account ID (team_id)team-123
SubAccountNameSub-account name (team_alias)Engineering Team
TagsAdditional metadata tagsSee below

LiteLLM Tags

When include_tags is enabled, the following tags are included:

TagDescription
litellm:providerLLM provider identifier
litellm:modelModel identifier
litellm:model_groupModel group name
litellm:user_idUser ID
litellm:api_key_prefixFirst 8 chars of API key
litellm:api_key_aliasAPI key alias
litellm:prompt_tokensNumber of prompt tokens
litellm:completion_tokensNumber of completion tokens
litellm:api_requestsNumber of API requests
litellm:successful_requestsNumber of successful requests
litellm:failed_requestsNumber of failed requests
litellm:cache_creation_tokensCache creation tokens
litellm:cache_read_tokensCache read tokens

Integration with FinOps Tools

APTIO

To import FOCUS data into APTIO:

  1. Export data using the CSV endpoint
  2. Upload the CSV file to APTIO's data import interface
  3. Map the FOCUS columns to APTIO's cost model

Other FinOps Tools

Most FinOps tools that support the FOCUS specification can import the exported data. Consult your tool's documentation for specific import procedures.

Time Range Filtering

Export data for a specific time range:

curl -X POST "http://localhost:4000/focus/export" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
-d '{
"start_time_utc": "2024-01-01T00:00:00Z",
"end_time_utc": "2024-01-31T23:59:59Z"
}' | jq

Troubleshooting

Common Issues

  1. No Data Returned

    • Verify that usage data exists in the database
    • Check that the time range filter includes data
    • Use the dry-run endpoint to debug
  2. Authentication Errors

    • Ensure you're using an admin API key
    • Verify the API key is valid
  3. Database Connection Issues

    • Verify database connection is configured
    • Check database connectivity