Skip to main content

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.

This guide provides instructions for integrating Pydantic Logfire with the TrueFoundry AI Gateway to export OpenTelemetry traces and metrics.

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:
  1. TrueFoundry Account: Create a TrueFoundry account and follow the instructions in our Gateway Quick Start Guide.
  2. 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:
RegionBase URL
UShttps://logfire-us.pydantic.dev
EUhttps://logfire-eu.pydantic.dev
You must append the signal path to the base URL yourself — TrueFoundry does not auto-append these paths:
  • Traces: https://logfire-us.pydantic.dev/v1/traces
  • Metrics: https://logfire-us.pydantic.dev/v1/metrics
Choose the region that matches where your Logfire project was created. You can confirm your region from the URL shown in your Logfire dashboard after logging in.

Integration Steps

1

Create a Write Token in Logfire

  1. Log into logfire.pydantic.dev and open your project.
  2. Navigate to Project SettingsWrite Tokens.
  3. Click Create Write Token, give it a name, and copy the token value immediately — it is shown only once.
Pydantic Logfire Project Settings page showing the Write Tokens section
Store the write token in a secrets manager. Enter it directly as the Authorization header value in TrueFoundry — the Logfire OTLP endpoint accepts the raw write token without a Bearer prefix.
2

Configure OTEL Export in TrueFoundry

  1. Go to AI GatewayControlsSettings in the TrueFoundry dashboard.
  2. Scroll down to the OTEL Config section and click the edit (✏️) button.
TrueFoundry AI Gateway Settings page showing the OTEL Config section
  1. Enable the Otel Traces Exporter Configuration toggle and fill in:
FieldValue
ToggleEnabled
ProtocolHTTP Configuration
Endpointhttps://logfire-us.pydantic.dev/v1/traces
EncodingProto
Header KeyAuthorization
Header Value<your-logfire-write-token>
TrueFoundry OTEL Traces Exporter Configuration showing Logfire endpoint and Authorization header
  1. Enable the Otel Metrics Exporter Configuration toggle and fill in:
FieldValue
ToggleEnabled
ProtocolHTTP Configuration
Endpointhttps://logfire-us.pydantic.dev/v1/metrics
EncodingProto
Header KeyAuthorization
Header Value<your-logfire-write-token>
  1. 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.
3

Verify the Integration

  1. Make a request through the TrueFoundry AI Gateway.
  2. Log into logfire.pydantic.dev and open your project.
  3. Navigate to the Live view and confirm spans with service.name tfy-llm-gateway are appearing.
Pydantic Logfire Live view showing LLM call traces from TrueFoundry AI Gateway
  1. Open the DashboardsUsage Overview view to confirm gateway metrics are flowing in.
Pydantic Logfire Usage Overview dashboard showing gateway metrics from TrueFoundry AI Gateway
Logfire automatically recognizes gen_ai.* span attributes emitted by the TrueFoundry gateway and renders them in its LLM panel — showing token usage, model names, and request/response content without any extra configuration.

Configuration Reference

ConfigurationValue
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
ProtocolHTTP
EncodingProto
Auth Header KeyAuthorization
Auth Header ValueYour Logfire write token (no Bearer prefix needed)