This guide provides instructions for integrating Pydantic Logfire with the TrueFoundry AI Gateway to export OpenTelemetry traces and metrics.Documentation Index
Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
Use this file to discover all available pages before exploring further.
What is Pydantic Logfire?
Pydantic Logfire is an observability platform built on OpenTelemetry that accepts OTLP traces and metrics over HTTP. It provides an LLM-aware interface that automatically detects GenAI semantic conventions and renders conversation replays, token usage, and cost breakdowns for AI workloads. It is offered as a managed cloud service with US and EU regions.Key Features of Pydantic Logfire
- LLM & AI Observability: Automatically detects GenAI span attributes and renders conversation replay, token usage, and cost data — no custom configuration needed.
- OpenTelemetry Native: Built on the OTLP standard, meaning any OTLP-compatible exporter can send traces and metrics to Logfire without using the Logfire SDK.
- Multi-region Ingestion: Provides dedicated ingestion endpoints for the US and EU regions to meet data residency requirements.
Prerequisites
Before integrating Pydantic Logfire with TrueFoundry, ensure you have:- TrueFoundry Account: Create a TrueFoundry account and follow the instructions in our Gateway Quick Start Guide.
- Pydantic Logfire Account: Sign up at logfire.pydantic.dev and create a project to obtain a write token.
Understanding the Logfire Endpoint
Logfire provides two regional base URLs:| Region | Base URL |
|---|---|
| US | https://logfire-us.pydantic.dev |
| EU | https://logfire-eu.pydantic.dev |
- Traces:
https://logfire-us.pydantic.dev/v1/traces - Metrics:
https://logfire-us.pydantic.dev/v1/metrics
Integration Steps
Create a Write Token in Logfire
- Log into logfire.pydantic.dev and open your project.
- Navigate to Project Settings → Write Tokens.
- Click Create Write Token, give it a name, and copy the token value immediately — it is shown only once.

Configure OTEL Export in TrueFoundry
- Go to AI Gateway → Controls → Settings in the TrueFoundry dashboard.
- Scroll down to the OTEL Config section and click the edit (✏️) button.

- Enable the Otel Traces Exporter Configuration toggle and fill in:
| Field | Value |
|---|---|
| Toggle | Enabled |
| Protocol | HTTP Configuration |
| Endpoint | https://logfire-us.pydantic.dev/v1/traces |
| Encoding | Proto |
| Header Key | Authorization |
| Header Value | <your-logfire-write-token> |

- Enable the Otel Metrics Exporter Configuration toggle and fill in:
| Field | Value |
|---|---|
| Toggle | Enabled |
| Protocol | HTTP Configuration |
| Endpoint | https://logfire-us.pydantic.dev/v1/metrics |
| Encoding | Proto |
| Header Key | Authorization |
| Header Value | <your-logfire-write-token> |
- Click Save to apply the configuration.
If your Logfire project is in the EU region, replace
logfire-us.pydantic.dev with logfire-eu.pydantic.dev in both the traces and metrics endpoint fields.Verify the Integration
- Make a request through the TrueFoundry AI Gateway.
- Log into logfire.pydantic.dev and open your project.
- Navigate to the Live view and confirm spans with service.name
tfy-llm-gatewayare appearing.

- Open the Dashboards → Usage Overview view to confirm gateway metrics are flowing in.

Configuration Reference
| Configuration | Value |
|---|---|
| Traces Endpoint (US) | https://logfire-us.pydantic.dev/v1/traces |
| Traces Endpoint (EU) | https://logfire-eu.pydantic.dev/v1/traces |
| Metrics Endpoint (US) | https://logfire-us.pydantic.dev/v1/metrics |
| Metrics Endpoint (EU) | https://logfire-eu.pydantic.dev/v1/metrics |
| Protocol | HTTP |
| Encoding | Proto |
| Auth Header Key | Authorization |
| Auth Header Value | Your Logfire write token (no Bearer prefix needed) |