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

# TrueFoundry integration

[TrueFoundry AI Gateway](https://www.truefoundry.com/ai-gateway) is an
enterprise-grade gateway and control plane for production LLM and agent
applications. It provides a single OpenAI-compatible interface for accessing
models while centralizing *routing*, *rate limits*, *quotas*, *cost controls*, *security*,
and *observability*.

Connect TrueFoundry to Lunary to monitor the LLM requests passing through your
gateway. Lunary receives OpenTelemetry traces and metrics, including prompts,
responses, model details, token usage, latency, and errors.

## Prerequisites

Before you start, make sure you have:

* A TrueFoundry account with [AI Gateway](https://www.truefoundry.com/docs/ai-gateway/quick-start) configured.
* A Lunary project with its Public Key copied from **Settings → API Keys**.

<Steps>
  <Step n="1" title="Open the OTEL configuration">
    In TrueFoundry, go to
    **Settings → Organisation → AI Gateway → OTEL Data Export Configuration**.

    <img src="https://mintcdn.com/lunary/vW_lDrslwbyKg98l/media/docs/truefoundry/1.png?fit=max&auto=format&n=vW_lDrslwbyKg98l&q=85&s=8a96036f5ded5f03808aaa4e6cd80b7d" alt="TrueFoundry OTEL data export configuration" width="1153" height="307" data-path="media/docs/truefoundry/1.png" />
  </Step>

  <Step n="2" title="Configure trace export">
    Enable **OTEL Traces Exporter Configuration**, select **HTTP Configuration**,
    and enter:

    | Setting  | Value                                       |
    | -------- | ------------------------------------------- |
    | Endpoint | `https://api.lunary.ai/v1/traces`           |
    | Encoding | `proto` or `json`                           |
    | Header   | `Authorization: Bearer <LUNARY_PUBLIC_KEY>` |

    Replace `<LUNARY_PUBLIC_KEY>` with your Lunary Public Key.

    <img src="https://mintcdn.com/lunary/vW_lDrslwbyKg98l/media/docs/truefoundry/4.png?fit=max&auto=format&n=vW_lDrslwbyKg98l&q=85&s=721032fb9039bc8f9afd2a71b3b0326f" alt="Configure trace export to Lunary" width="1501" height="1048" data-path="media/docs/truefoundry/4.png" />
  </Step>

  <Step n="3" title="Optionally configure metrics">
    To export aggregate metrics, enable **OTEL Metrics Exporter Configuration** and
    use `https://api.lunary.ai/v1/metrics` with the same encoding and authorization
    header.
  </Step>

  <Step n="4" title="Save and verify">
    Save the configuration and send a request through [TrueFoundry AI Gateway](https://www.truefoundry.com/ai-gateway). In
    Lunary, open **Explore → Traces** and confirm that the gateway trace appears.

    <img src="https://mintcdn.com/lunary/vW_lDrslwbyKg98l/media/docs/truefoundry/6.png?fit=max&auto=format&n=vW_lDrslwbyKg98l&q=85&s=cddf8664e4f1c3ca3abfd643d202e092" alt="TrueFoundry gateway trace in Lunary" width="1181" height="719" data-path="media/docs/truefoundry/6.png" />
  </Step>
</Steps>

Once connected, TrueFoundry continues to handle model routing and governance
while Lunary gives you a detailed view of each request, making it easier to
investigate failures, compare model performance, and track usage over time.

For advanced fields and more details, see the
[TrueFoundry OTEL data export tutorial](https://www.truefoundry.com/docs/ai-gateway/export-opentelemetry-data).
