Skip to content

Releases: Cloudzero/cloudzero-litellm-toolkit

Release v0.6.2

29 Jul 02:31
Compare
Choose a tag to compare

Major Improvements

🏗️ Transmit Module Refactoring

  • Split monolithic DataTransmitter into focused components with single responsibilities
  • Introduced dependency injection for all components
  • Created protocol-based design with OutputHandler and Transmitter interfaces
  • Added test-friendly implementations: NullOutput, MockTransmitter, CollectingOutput
  • Comprehensive test suite with 27 new tests demonstrating improved testability
  • Full backward compatibility maintained

🧪 CI/CD Safe Testing

  • Updated all smoke tests to not require real database connections
  • All tests now safe for automated CI/CD pipelines
  • Mocked HTTP calls for transmit functionality testing

🔒 PII Obfuscation

  • Anonymized all names, emails, and API keys in test.sqlite
  • Updated create_test_sqlite.py script to generate only anonymized test data
  • Reviewed entire codebase to ensure no PII is present

🗄️ SQLite Support

  • Full SQLite database support for all operations
  • Proper URL parsing for sqlite:// connection strings
  • SQL syntax adaptation between PostgreSQL and SQLite

Bug Fixes

  • Fixed date filtering in SQLite implementation for data source strategies
  • Fixed CLI mode mapping to correctly handle 'today', 'yesterday', 'date-range' modes
  • Fixed CLI error handling to properly exit with error code when transmit fails
  • Fixed BatchAnalyzer to correctly group data by date in refactored transmit module

Testing

  • All 97 tests passing including new refactored transmit tests
  • SQLite integration fully tested with transmit functionality
  • All smoke tests are now CI/CD safe

Installation

pip install ll2cz==0.6.2

Full Changelog

See CHANGELOG.md for detailed changes.

v0.6.1 - Import Fixes and CLI Tests

28 Jul 19:05
Compare
Choose a tag to compare

🐛 Bug Fixes

Fixed Import Errors

  • Fixed ImportError in data_processor.py - extract_model_name now correctly imported from model_name_strategies
  • Added __main__.py to enable running package as module: python -m ll2cz

🧪 Testing Improvements

New Test Suites

  • test_imports.py: Comprehensive import tests to prevent future import errors
    • Tests all modules can be imported
    • Verifies critical imports work correctly
    • Detects circular dependencies
  • test_cli_smoke.py: Smoke tests for all CLI commands
    • Ensures all commands start without crashing
    • Verifies help works for all subcommands
  • test_cli.py: Detailed CLI command tests

Test Coverage

  • All CLI commands verified working: transmit, analyze, transform, cache, config
  • 37 tests passing (21 core + 16 new tests)

📦 Installation

pip install ll2cz==0.6.1

Full Changelog: v0.6.0...v0.6.1

v0.6.0 - Python 3.9+ Support

28 Jul 18:23
Compare
Choose a tag to compare

What's Changed

🎉 Expanded Python Version Support

  • Now supports Python 3.9, 3.10, 3.11, 3.12, and 3.13 (previously only 3.12+)
  • Updated all type annotations to use typing module imports for compatibility
  • Changed modern syntax (dict[str, Any]) to compatible syntax (Dict[str, Any])
  • Changed union syntax (T | None) to Optional[T]

🔧 Technical Changes

  • Updated pyproject.toml to require Python >=3.9
  • Added Python version classifiers for all supported versions
  • Fixed import paths for extract_model_name function
  • Applied ruff formatting fixes throughout the codebase
  • All 21 tests passing on Python 3.12

📦 Installation

pip install ll2cz==0.6.0

Full Changelog: v0.5.1...v0.6.0

v0.4.0: Cost Comparison Analysis & SpendLogs Support

27 Jul 02:44
Compare
Choose a tag to compare

🚀 Major Features

Cost Comparison Analysis

  • New comprehensive cost comparison between SpendLogs and user tables in ll2cz analyze spend
  • Side-by-side metrics comparison: spend, tokens, requests, models, providers
  • Date range coverage analysis showing data gaps and overlaps
  • Provider and model coverage analysis identifying source-specific data
  • Automated discrepancy classification: minimal/minor/moderate/major with actionable explanations

SpendLogs Support

  • New --source option for analyze data and transmit commands supporting 'usertable' and 'logs'
  • SpendLogs data access methods with organization enrichment
  • Transaction-level analysis alongside existing daily aggregated data

Centralized Data Processing

  • New DataProcessor class consolidating CZRN/CBF generation logic
  • Eliminated code duplication across CZRN generation, CBF transformation, and analysis
  • Source-aware field mapping with consistent transformations
  • Enhanced error tracking and field analysis improvements

🔧 Technical Improvements

Transmission Fixes

  • Fixed timestamp processing for datetime objects in CloudZero transmission
  • Added Decimal serialization support for PostgreSQL numeric types
  • Fixed resource/id construction consistency between data sources
  • Added model_family tag extraction for all transmission use cases

Code Quality

  • All linting issues resolved and tests passing
  • Comprehensive error tracking with detailed field analysis
  • Enhanced field mapping analysis with source-aware transformations

📊 Cost Comparison Features

The new cost comparison analysis provides:

  1. Metrics Comparison Table

    • Total spend, records, providers, models
    • Request volumes and token usage
    • Average cost per request/token
    • Percentage differences with color coding
  2. Date Coverage Analysis

    • Date ranges for each data source
    • Gap identification and overlap analysis
    • Days covered comparison
  3. Provider & Model Coverage

    • Common providers/models between sources
    • Source-specific data identification
    • Coverage gap analysis
  4. Discrepancy Classification

    • Automated severity assessment
    • Actionable explanations for differences
    • Potential causes and remediation guidance

📦 Installation

pip install ll2cz==0.4.0

🔗 Links

🙏 What's Next

This release significantly enhances data analysis capabilities and provides better visibility into cost discrepancies between different LiteLLM data sources. Future releases will continue to improve analysis features and data source support.

v0.3.0 - Enhanced CBF Schema and Model Name Extraction

24 Jul 22:24
Compare
Choose a tag to compare

🚀 New Features

CBF Schema Improvements

  • CBF resource/id now uses cloud-local-id instead of full CZRN for cleaner resource identification
  • Added resource/tag:czrn field containing the full CZRN for applications that need complete resource reference
  • Enhanced field analysis now shows all CZRN and CBF schema fields including constants/derived fields

Model Name Extraction Enhancements

  • Enhanced claude-2.1 handling - now correctly extracts "claude" from "claude-2.1" format
  • Improved AWS Bedrock support - handles Anthropic models like "us.anthropic.claude-3-7-sonnet-20250219-v1:0" → "claude-sonnet"
  • Fixed provider.model parsing - no longer treats version numbers like "2.1" as provider prefixes

Provider Normalization Improvements

  • Renamed normalize_provider to normalize_service for better semantic clarity
  • Enhanced provider mapping - automatically drops suffixes like "azure_ai" → "azure"
  • Improved edge case handling for unknown providers with separators

🔧 Improvements

Field Analysis & Documentation

  • Complete schema visibility - field analysis now includes all constant/derived fields (resource/id, usage/units, lineitem/type, etc.)
  • Better field categorization - separates source fields from constant/derived fields in coverage reports
  • Enhanced color coding - italicized display for constant fields vs bold for source fields

Code Quality

  • Comprehensive test coverage - all new functionality covered by tests
  • Linting compliance - fixed all ruff linting issues
  • Better error handling - improved transformation error tracking

⚠️ Breaking Changes

  • CBF resource/id field now contains cloud-local-id instead of full CZRN
    • Migration: Use resource/tag:czrn to access the full CZRN if needed
  • Function rename: normalize_provider()normalize_service()
    • Migration: Update any direct function calls to use the new name

📊 Field Mapping Changes

New CBF Fields

  • resource/tag:czrn - Contains the full CZRN string
  • All constant fields now visible in schema analysis

Updated CBF Fields

  • resource/id - Now contains cloud-local-id (e.g., "openai/gpt-4")
  • Field analysis includes complete CZRN/CBF schema documentation

🧪 Testing

  • ✅ All existing tests pass
  • ✅ New functionality covered by comprehensive tests
  • ✅ Linting and code quality checks pass

This release enhances the CBF schema for better resource identification while maintaining backward compatibility through resource tags.

Release v0.2.1: Fix all tests and linting issues

24 Jul 15:29
Compare
Choose a tag to compare

Bug Fixes and Improvements

  • Fixed CZRN generation tests to reflect new key_alias/api_key mapping logic
  • Fixed CBF transformation tests with updated expected values
  • Fixed parse_date() function that was returning None due to incorrect polars datetime conversion
  • Updated provider normalization test cases to match current implementation
  • Fixed duplicate dictionary key in transformations.py field mappings
  • Replaced bare except statements with specific Exception handling
  • Converted generator comprehensions to set comprehensions for better performance
  • Fixed trailing whitespace and formatting issues throughout codebase

Test Results

✅ All tests now pass (17/17)
✅ Code quality checks are clean

Installation

pip install ll2cz==0.2.1

View on PyPI: https://pypi.org/project/ll2cz/0.2.1/