Name | litellm-cz-etl JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | Transform LiteLLM database data into CloudZero AnyCost CBF format |
upload_time | 2025-07-23 04:04:56 |
maintainer | None |
docs_url | None |
author | Erik Peterson |
requires_python | >=3.12 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# LiteLLM to CloudZero ETL Tool
Transform LiteLLM database data into CloudZero AnyCost CBF format for cost tracking and analysis.
## Features
- Extract usage data from LiteLLM PostgreSQL database
- Transform data into CloudZero Billing Format (CBF)
- Analysis mode for data inspection and validation
- Multiple output options: CSV files or direct CloudZero API streaming
- Built with modern Python tools: uv, ruff, pytest
## Installation
```bash
# Install from PyPI (once published)
uv add litellm-cz-etl
# Or install from source
git clone <repository-url>
cd litellm-cz-etl
uv sync
```
## Usage
### Analysis Mode
Inspect your LiteLLM data to understand its structure:
```bash
# Analyze 100 recent records
litellm-cz-etl --input "postgresql://user:pass@host:5432/litellm_db" --analysis 100
# Save analysis results to JSON
litellm-cz-etl --input "postgresql://user:pass@host:5432/litellm_db" --analysis 100 --json analysis.json
```
### Export to CSV
```bash
litellm-cz-etl --input "postgresql://user:pass@host:5432/litellm_db" --csv output.csv
```
### Stream to CloudZero AnyCost API
```bash
litellm-cz-etl --input "postgresql://user:pass@host:5432/litellm_db" \
--cz-api-key "your-cloudzero-api-key" \
--cz-connection-id "your-connection-id"
```
## Data Transformation
The tool transforms LiteLLM usage logs into CloudZero's CBF format with the following mappings:
- `spend` → `cost`
- `total_tokens` → `usage_quantity`
- `model`, `user_id`, `call_type` → `dimensions`
- `metadata` fields → additional `dimensions`
- Duration calculated from `startTime` and `endTime`
## Development
```bash
# Setup development environment
uv sync --dev
# Run tests
uv run pytest
# Run linting
uv run ruff check src/ tests/
# Fix linting issues
uv run ruff check --fix src/ tests/
```
## Requirements
- Python ≥ 3.12
- PostgreSQL database with LiteLLM data
- CloudZero API key and connection ID (for streaming mode)
## License
Open source - see LICENSE file for details.
EOF < /dev/null
Raw data
{
"_id": null,
"home_page": null,
"name": "litellm-cz-etl",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": null,
"author": "Erik Peterson",
"author_email": "Erik Peterson <erik@cloudzero.com>",
"download_url": "https://files.pythonhosted.org/packages/89/5c/54fe91f8b56c2c31c4a6a97b1988e59d895154644a7a1a500946b0638897/litellm_cz_etl-0.1.0.tar.gz",
"platform": null,
"description": "# LiteLLM to CloudZero ETL Tool\n\nTransform LiteLLM database data into CloudZero AnyCost CBF format for cost tracking and analysis.\n\n## Features\n\n- Extract usage data from LiteLLM PostgreSQL database\n- Transform data into CloudZero Billing Format (CBF)\n- Analysis mode for data inspection and validation\n- Multiple output options: CSV files or direct CloudZero API streaming\n- Built with modern Python tools: uv, ruff, pytest\n\n## Installation\n\n```bash\n# Install from PyPI (once published)\nuv add litellm-cz-etl\n\n# Or install from source\ngit clone <repository-url>\ncd litellm-cz-etl\nuv sync\n```\n\n## Usage\n\n### Analysis Mode\n\nInspect your LiteLLM data to understand its structure:\n\n```bash\n# Analyze 100 recent records\nlitellm-cz-etl --input \"postgresql://user:pass@host:5432/litellm_db\" --analysis 100\n\n# Save analysis results to JSON\nlitellm-cz-etl --input \"postgresql://user:pass@host:5432/litellm_db\" --analysis 100 --json analysis.json\n```\n\n### Export to CSV\n\n```bash\nlitellm-cz-etl --input \"postgresql://user:pass@host:5432/litellm_db\" --csv output.csv\n```\n\n### Stream to CloudZero AnyCost API\n\n```bash\nlitellm-cz-etl --input \"postgresql://user:pass@host:5432/litellm_db\" \\\n --cz-api-key \"your-cloudzero-api-key\" \\\n --cz-connection-id \"your-connection-id\"\n```\n\n## Data Transformation\n\nThe tool transforms LiteLLM usage logs into CloudZero's CBF format with the following mappings:\n\n- `spend` \u2192 `cost`\n- `total_tokens` \u2192 `usage_quantity`\n- `model`, `user_id`, `call_type` \u2192 `dimensions`\n- `metadata` fields \u2192 additional `dimensions`\n- Duration calculated from `startTime` and `endTime`\n\n## Development\n\n```bash\n# Setup development environment\nuv sync --dev\n\n# Run tests\nuv run pytest\n\n# Run linting\nuv run ruff check src/ tests/\n\n# Fix linting issues\nuv run ruff check --fix src/ tests/\n```\n\n## Requirements\n\n- Python \u2265 3.12\n- PostgreSQL database with LiteLLM data\n- CloudZero API key and connection ID (for streaming mode)\n\n## License\n\nOpen source - see LICENSE file for details.\nEOF < /dev/null",
"bugtrack_url": null,
"license": null,
"summary": "Transform LiteLLM database data into CloudZero AnyCost CBF format",
"version": "0.1.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e3855d69f00f7918b1417e7e8d66c017e6270ea54e87bf587c364f3ac2e51c46",
"md5": "e6da4080132af0e0812178fdbfe47966",
"sha256": "26df84210eb6e7561013864b35ef65b0ea6aa86f6f4383fda90aefc40c5a6f89"
},
"downloads": -1,
"filename": "litellm_cz_etl-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e6da4080132af0e0812178fdbfe47966",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 8872,
"upload_time": "2025-07-23T04:04:54",
"upload_time_iso_8601": "2025-07-23T04:04:54.105073Z",
"url": "https://files.pythonhosted.org/packages/e3/85/5d69f00f7918b1417e7e8d66c017e6270ea54e87bf587c364f3ac2e51c46/litellm_cz_etl-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "895c54fe91f8b56c2c31c4a6a97b1988e59d895154644a7a1a500946b0638897",
"md5": "f43f01bf38f4218b9afbf9813945ebc7",
"sha256": "c7041d71abc659f741dcc35898856c5c40b82c4b7275e4a5ceb426a87654d952"
},
"downloads": -1,
"filename": "litellm_cz_etl-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "f43f01bf38f4218b9afbf9813945ebc7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 6251,
"upload_time": "2025-07-23T04:04:56",
"upload_time_iso_8601": "2025-07-23T04:04:56.460919Z",
"url": "https://files.pythonhosted.org/packages/89/5c/54fe91f8b56c2c31c4a6a97b1988e59d895154644a7a1a500946b0638897/litellm_cz_etl-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-23 04:04:56",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "litellm-cz-etl"
}