> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uselumina.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Single-Span Tracing

> Track individual LLM calls with single-span tracing

Track individual LLM calls with automatic attribute extraction.

***

## Basic Usage

```typescript theme={null}
const response = await lumina.traceLLM(
  () =>
    openai.chat.completions.create({
      model: 'gpt-4',
      messages: [{ role: 'user', content: 'Hello!' }],
    }),
  {
    name: 'chat-completion',
    system: 'openai',
    prompt: 'Hello!',
  }
);
```

***

## Automatic Attributes

Lumina automatically extracts:

* Model name
* Token counts (prompt, completion)
* Latency (milliseconds)
* Cost (USD)
* Status (success/error)
* Response text

***

## Custom Metadata

Add custom attributes:

```typescript theme={null}
await lumina.traceLLM(
  () => llm.generate(prompt),
  {
    name: 'chat',
    metadata: {
      userId: 'user-123',
      sessionId: 'session-456',
      feature: 'customer-support',
    },
  }
);
```

***

## Next Steps

<Card title="Multi-Span Tracing" href="/docs/features/tracing/multi-span">
  Track complex workflows with hierarchical spans
</Card>
