Skip to main content

Respan exporter for LiteLLM

Project description

Respan LiteLLM Exporter

LiteLLM integration for exporting logs and traces to Respan.

Installation

pip install respan-exporter-litellm

Quick Start

Callback Mode

Use the callback to send traces to Respan:

import litellm
from respan_exporter_litellm import RespanLiteLLMCallback

# Setup callback
callback = RespanLiteLLMCallback(api_key="your-respan-api-key")
callback.register_litellm_callbacks()

# Make LLM calls - traces are automatically sent
response = litellm.completion(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}],
)

Proxy Mode

Route requests through Respan gateway:

import litellm

response = litellm.completion(
    api_key="your-respan-api-key",
    api_base="https://api.respan.ai/api",
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}],
)

Logging

If you just want individual logs (no trace/span IDs), omit trace fields and send only basic metadata. This will produce one log per request.

Callback Mode (with respan_params)

import litellm
from respan_exporter_litellm import RespanLiteLLMCallback

callback = RespanLiteLLMCallback(api_key="your-api-key")
callback.register_litellm_callbacks()

response = litellm.completion(
    api_key="your-api-key",
    api_base="https://api.respan.ai/api",
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}],
    metadata={
        "respan_params": {
            "workflow_name": "simple_logging",
            "span_name": "single_log",
            "customer_identifier": "user-123",
        }
    },
)

Proxy Mode (with extra_body)

import litellm

response = litellm.completion(
    api_key="your-respan-api-key",
    api_base="https://api.respan.ai/api",
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}],
    extra_body={
        "span_workflow_name": "simple_logging",
        "span_name": "single_log",
        "customer_identifier": "user-123",
    },
)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respan_exporter_litellm-1.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

respan_exporter_litellm-1.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file respan_exporter_litellm-1.0.1.tar.gz.

File metadata

  • Download URL: respan_exporter_litellm-1.0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.8 Darwin/25.2.0

File hashes

Hashes for respan_exporter_litellm-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0ce3733bc962b0dd5b7d5c8c9a8409a82d73f06e1e2a69d02671fc72759c5c00
MD5 051b5cf83e123656014b12a23a121fc0
BLAKE2b-256 e447f12ee9b82349022c5effd3e9bea8953ea1fb3243e1b98e234b81d02a1038

See more details on using hashes here.

File details

Details for the file respan_exporter_litellm-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_exporter_litellm-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa155485d9cbcecde6cc42fc60990da9984a3259bbc20f25198d58f4649caf03
MD5 73fda4618c07198327cbae1a08284eae
BLAKE2b-256 3b39db9e2cf10f127140b1067e77849771e022eb502bcb51eb52e4f4c8674b19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page