Skip to main content

luca-litellm

Send the cost of every call through your LiteLLM proxy to Luca, so your finance team gets AI spend by customer, team and model, accrued and matched to each provider's invoice, with journal entries for the ERP.

Only the fields accounting needs leave your network: when the call was made, the provider and model, the cost and token counts, and the team, key, project, customer, tags and MCP server LiteLLM records with it. The plugin drops the prompt, the response, tool arguments and tool results before anything is sent. Email addresses are left out unless you turn them on.

Set up

  1. In Luca, add a LiteLLM AI gateway connection. Luca shows its webhook URL. Make an ingest token for it: openssl rand -hex 32
  2. On the machine that runs the proxy:
    pip install luca-litellm
    
  3. Add the plugin to the proxy's config.yaml:
    litellm_settings:
      callbacks: ["luca_litellm.handler"]
    
  4. Set two environment variables for the proxy:
    LUCA_LITELLM_URL=<the webhook URL Luca shows>
    LUCA_LITELLM_TOKEN=<the ingest token>
    
  5. Check the address and token work. With the two variables set:
    luca-litellm check
    
    It sends Luca one test record, which Luca answers and never counts as usage.
  6. Restart the proxy.

The plugin sends calls in batches (every 10 seconds, or every 200 calls), outside the request path, so it adds no time to your calls. If Luca can't be reached, it keeps the calls and tries again.

Which customer a call served, and what it was for

LiteLLM records a customer for each call when your app passes user in the request, or when the call uses a key or team set up for that customer. Luca uses it to show AI cost by customer.

  • Send the customer's ID in user, as it appears in your ERP's customer list, so cost of revenue can name the customer.
  • Tag each request with what it is for, for example product, research or internal. Finance maps each tag to an account.
  • Calls with neither go to unallocated AI expense until finance maps them. Luca's month report shows the share of cost that has a function and a customer.
client.chat.completions.create(model="gpt-4o", messages=messages, user="acme-corp",
                               extra_body={"metadata": {"tags": ["product"]}})

Options

Variable What it does
LUCA_LITELLM_URL The connection's webhook URL (required)
LUCA_LITELLM_TOKEN The connection's ingest token (required)
LUCA_LITELLM_INCLUDE_EMAIL true to send the user's email address with each call (off by default)

To use it from the LiteLLM Python SDK instead of the proxy:

import litellm
from luca_litellm import LucaLogger
litellm.callbacks = [LucaLogger(url="https://…", token="…")]

Without installing a package

LiteLLM's built-in webhook callback can send the same calls. Luca shows that configuration on the connection too. With it, turn message logging off (turn_off_message_logging: true) so prompts and responses are not sent.

Apache-2.0. Questions: hello@luca.network

Metadata

Release files for luca-litellm 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for luca-litellm 0.1.2
File Size Uploaded Provenance Actions
luca_litellm-0.1.2.tar.gz 13.6 kB With provenance Details for luca_litellm-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for luca-litellm 0.1.2
File Interpreter ABI Platform Actions
luca_litellm-0.1.2-py3-none-any.whl Python 3 none any Details for luca_litellm-0.1.2-py3-none-any.whl

Total release size: 25.7 kB

Release files / luca_litellm-0.1.2.tar.gz

Download URL luca_litellm-0.1.2.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
58efa7dc1670cc0ecbdb4ddb17ba435f1504d2ce6b7dabde4231770607692ef4
BLAKE2b-256 checksum
How to use checksums
e6e9209017566c8731407f9ea9328a2c37d2b1f722c506f9ae7a5c8358171952
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / luca_litellm-0.1.2-py3-none-any.whl

Download URL luca_litellm-0.1.2-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb6267a1b4b8ff29cd1f7524e7eae702ccff4ae3fba8b8976b887ceb1697bf0b
BLAKE2b-256 checksum
How to use checksums
8afb3789025e5f9fe0d89f954ccd2537eabfba82ae7f9ef4263dfb89925f029e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for luca-litellm 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for luca_litellm-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page