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

# Bifrost (Gateway)

> Send Bifrost's OpenTelemetry traces to Zespan with its otel plugin, no Zespan SDK required.

> [!NOTE]
>
> Available via: **Bifrost's `otel` plugin**. This is not a Zespan SDK wrapper, see [Send traces from any OTel-instrumented app](https://docs.zespan.com/sdk/otel-integration.md#send-traces-from-any-otel-instrumented-app-no-zespan-sdk) for how the endpoint works.

[Bifrost](https://docs.getbifrost.ai) is an open-source AI gateway with an OpenTelemetry plugin. Enable it with the GenAI trace format and point it at Zespan.

## Setup

**1. Enable the otel plugin with GenAI traces**

In Bifrost's configuration enable the `otel` plugin and set `trace_type: genai_extension` and `protocol: http` (Bifrost sends JSON or protobuf over HTTP, both accepted); Zespan's endpoint is HTTP, so `grpc` is not an option. These field names are from Bifrost's observability documentation; check them for your version.

**2. Set the destination and key**

`collector_url: https://api.zespan.com/v1/traces`, and in `headers` add `x-api-key: zsp_...` (or `Authorization: Bearer zsp_...`).

**3. Verify**

Send one request through Bifrost, then open **Settings → Instrumentation → Gateway and OTLP data** and press **Refresh**. See [Instrumentation](https://docs.zespan.com/dashboard/instrumentation.md#gateway-and-otlp-data).

## What gets captured

| Field | Read from | Notes |
| - | - | - |
| Model, provider | GenAI attribute names | The gateway is recognised by the service name `bifrost` or a `bifrost.*` key. If the card shows *OpenTelemetry*, the data is stored but not marked as Bifrost's: set the resource attribute `zespan.gateway=bifrost` |
| Token counts | `gen_ai.usage.prompt_tokens`, `gen_ai.usage.completion_tokens` | Bifrost uses the older names; Zespan maps them (compatibility mapping, on by default) |
| Cost | Zespan's own price table | Bifrost's figure (`gen_ai.usage.cost`) is kept as evidence |
| Prompt and answer text | Captured by Bifrost unless you set its `disable_content_logging` | Whether Zespan stores any follows your project's capture setting |
| Retries | Not on spans | Bifrost reports retries only as a metric, which Zespan does not receive |

> [!NOTE]
>
> Attribute names come from Bifrost's published documentation and can change between versions. Use the **Gateway and OTLP data** card to see what actually arrives.

> [!NOTE]
>
> Gateway identity metadata is not stored. See [AI gateways](https://docs.zespan.com/sdk/otel-integration.md#ai-gateways) and [Security](https://docs.zespan.com/platform/security.md).

## Using the SDK too

Bifrost documents that an inbound W3C `traceparent` takes precedence for the trace it exports, so turning on the SDK's [`gatewayCorrelation`](https://docs.zespan.com/sdk/otel-integration#using-the-sdk-too) option for your Bifrost host makes its span a child of the SDK span. Zespan can then count the call's tokens and cost once when merging is on and the span was recognised as Bifrost's. Bifrost does not document the provider's response id on its span, so use `gatewayCorrelation` rather than relying on the response-id match.

## Next steps

* [OTel integration](https://docs.zespan.com/sdk/otel-integration.md), the endpoint, limits and attributes Zespan reads
* [Instrumentation](https://docs.zespan.com/dashboard/instrumentation.md#gateway-and-otlp-data), check what arrived
* [LiteLLM Proxy](https://docs.zespan.com/sdk/integrations/litellm-proxy.md), [Kong AI Gateway](https://docs.zespan.com/sdk/integrations/kong-ai-gateway.md), other gateways


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