Skip to main content
Common patterns for using the Lumina Python SDK.

Single LLM Call

Wrap any LLM call with trace_llm to capture model, tokens, cost, and latency automatically:
The same pattern works for Anthropic:

Adding Metadata

Attach structured metadata and tags to any trace for filtering and grouping in the dashboard:

Async Usage

trace_llm automatically detects async callables and awaits them — no separate async method needed:

Error Handling

Errors are automatically recorded on the span. Re-raise to propagate them normally:

Next Steps

Advanced Usage

Multi-span tracing and async patterns

API Reference

Complete API docs