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

# Tracing Images

Tracevell automatically detects and stores image data sent to vision-capable models across supported integrations.

* Captures both **Base64 data URLs** and **image URLs**
* Works transparently in the background (no tracing-specific code required)
* Renders images inline in the trace view so you can debug multimodal runs

## OpenAI Example (Base64 Image)

> [tab] TypeScript
>
> ```typescript theme={null}
> import OpenAI from 'openai';
> import fs from 'node:fs';
> import { Tracevell, observe } from '@lmnr-ai/lmnr';
>
> Laminar.initialize({
>   projectApiKey: process.env.LMNR_PROJECT_API_KEY,
>   instrumentModules: { OpenAI },
> });
>
> const openai = new OpenAI.OpenAI({ apiKey: process.env.OPENAI_API_KEY });
>
> const analyzeImage = (imagePath: string, userQuestion: string) =>
>   observe({ name: 'analyzeImage' }, async () => {
>     const base64 = fs.readFileSync(imagePath).toString('base64');
>
>     const response = await openai.chat.completions.create({
>       model: 'gpt-4o',
>       messages: [
>         {
>           role: 'user',
>           content: [
>             { type: 'text', text: userQuestion },
>             {
>               type: 'image_url',
>               image_url: { url: `data:image/jpeg;base64,${base64}` },
>             },
>           ],
>         },
>       ],
>       max_tokens: 500,
>     });
>
>     return response.choices[0].message.content;
>   });
> ```

> [tab] Python
>
> ```python theme={null}
> import base64
> from openai import OpenAI
> from lmnr import Tracevell, observe
>
> Laminar.initialize()
> client = OpenAI()
>
> @observe()
> def analyze_image(image_path: str, user_question: str) -> str:
>     with open(image_path, "rb") as f:
>         base64_image = base64.b64encode(f.read()).decode("utf-8")
>
>     response = client.chat.completions.create(
>         model="gpt-4o",
>         messages=[
>             {
>                 "role": "user",
>                 "content": [
>                     {"type": "text", "text": user_question},
>                     {
>                         "type": "image_url",
>                         "image_url": {
>                             "url": f"data:image/jpeg;base64,{base64_image}"
>                         },
>                     },
>                 ],
>             }
>         ],
>         max_tokens=500,
>     )
>     return response.choices[0].message.content
> ```

## Image URLs

If you reference an image by URL instead of uploading it, Tracevell traces the URL and associates it with the LLM call (no extra tracing code needed).

### OpenAI Example (Image URL)

> [tab] TypeScript
>
> ```typescript theme={null}
> import OpenAI from 'openai';
> import { observe } from '@lmnr-ai/lmnr';
>
> const openai = new OpenAI.OpenAI({ apiKey: process.env.OPENAI_API_KEY });
>
> const analyzeWebImage = (imageUrl: string, analysisPrompt: string) =>
>   observe({ name: 'analyzeWebImage' }, async () => {
>     const response = await openai.chat.completions.create({
>       model: 'gpt-4o',
>       messages: [
>         {
>           role: 'user',
>           content: [
>             { type: 'text', text: analysisPrompt },
>             { type: 'image_url', image_url: { url: imageUrl, detail: 'high' } },
>           ],
>         },
>       ],
>     });
>
>     return response.choices[0].message.content;
>   });
> ```

> [tab] Python
>
> ```python theme={null}
> from openai import OpenAI
> from lmnr import observe
>
> client = OpenAI()
>
> @observe()
> def analyze_web_image(image_url: str, analysis_prompt: str) -> str:
>     response = client.chat.completions.create(
>         model="gpt-4o",
>         messages=[
>             {
>                 "role": "user",
>                 "content": [
>                     {"type": "text", "text": analysis_prompt},
>                     {
>                         "type": "image_url",
>                         "image_url": {"url": image_url, "detail": "high"},
>                     },
>                 ],
>             }
>         ],
>     )
>     return response.choices[0].message.content
> ```

## Viewing Images in Tracevell Platform

When you send images to LLM models, Tracevell renders them in the trace view:

![Trace view showing an image input](https://mintcdn.com/laminarai/RPYdoMdfsv6y-QUL/images/traces/trace-image.png?fit=max\&auto=format\&n=RPYdoMdfsv6y-QUL\&q=85\&s=2d24a12f0659d216d2d78322c54338e1)

In the Tracevell platform, you can:

* View the actual images that were sent to the model
* Click on the image to view it in a larger view
* Correlate images with model responses for debugging
* Track image usage across different traces and sessions

## Supported Integrations

Start here:

* [OpenAI](https://tracevell.com/docs/integrations/openai.md)
* [Anthropic](https://tracevell.com/docs/integrations/anthropic.md)
* [Gemini](https://tracevell.com/docs/integrations/gemini.md)
* [LangChain](https://tracevell.com/docs/integrations/langchain.md)
* [Vercel AI SDK](https://tracevell.com/docs/integrations/vercel-ai-sdk.md)
* [LiteLLM](https://tracevell.com/docs/integrations/litellm.md)
* [Browser Use](https://tracevell.com/docs/integrations/browser-use.md)
* [Stagehand](https://tracevell.com/docs/integrations/stagehand.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.