Tracing Kong AI Gateway traffic with Langfuse

Kong's AI Proxy plugins emit Gen AI spans that its OpenTelemetry plugin can export straight to a self-hosted Langfuse endpoint, so LLM calls are traced at the gateway without collectors or per-application instrumentation.

On this page

How Kong AI Gateway traces reach Langfuse without a collector

A platform team that routes LLM traffic through Kong can capture those calls centrally, without adding a tracing collector in the middle. When many applications call OpenAI, Azure OpenAI, Anthropic or other providers directly, each team decides for itself which spans, token counts and metadata get recorded, so coverage is uneven. Kong's AI Proxy plugins emit Gen AI span attributes for the traffic they handle, and Kong's bundled OpenTelemetry plugin exports those spans over OTLP/HTTP straight to the OpenTelemetry endpoint of your self-hosted Langfuse. The path is gateway to Langfuse, with no OpenTelemetry Collector required for this hop.

The integration moves the instrumentation point, not the application logic. Applications keep calling the gateway as they do today, and the gateway records the request and response metadata that the AI Proxy plugin exposes. It does not replace application-level traces, so prompt construction, retrieval steps, tool calls and user or session identifiers still need instrumentation in the application if you want them. Confirm with Kong's plugin documentation which attributes your plugin version emits, and check with Langfuse's Kong guide how those attributes map to Langfuse observations, since mapping details and cost calculation depend on the model names the gateway reports.

Before you point production traffic at the gateway, decide where the Langfuse endpoint and its credentials live in Kong's configuration, who can read or change that plugin configuration, and how the exporter behaves when Langfuse is slow or unreachable. Test with a non-production route, confirm that prompts and completions are captured or masked as your policy requires, and check that a request appears in Langfuse with the expected provider and model. Those checks belong to the rollout plan, and they determine whether central tracing is trustworthy enough to rely on.

What you need in place before connecting Kong to Langfuse

Connecting Kong to Langfuse touches three things you control: the gateway version and edition, the Langfuse endpoint and keys, and the network path between them. Confirm each one before you change any gateway configuration, so a failed export points to a single cause.

Kong Gateway version for AI Proxy

The AI Proxy plugin needs Kong Gateway 3.6 or later, and some of its features need 3.10 or 3.11. Check the exact version of every gateway node, including data planes in hybrid mode, because a mixed fleet will produce different Gen AI spans depending on which node handled a request. Record the version you plan to run and confirm which AI Proxy features you rely on before you choose it.

AI Proxy docs

Open-source 3.9 line versus Enterprise

The open-source repository's newest release line is 3.9, while Kong Gateway Enterprise has moved to newer versions on a quarterly cadence. AI Proxy Advanced, with its load balancing algorithms, is documented only in the AI Gateway Enterprise offering and needs 3.8 or later. Decide which edition you run, then confirm its current support status with Kong's version support policy, which covers only Enterprise.

Version support policy

Reachable Langfuse OTLP endpoint

Kong's OpenTelemetry plugin sends OTLP over HTTP directly to Langfuse's /api/public/otel endpoint, so no collector sits in between. Confirm that your self-hosted Langfuse Web service answers on that path from the gateway, and that the host name resolves to the address you expect. Verify with a test request before enabling the plugin on production routes.

Langfuse Kong guide

Project API keys

Langfuse authenticates OTLP traffic with the public and secret key of a project, sent as a header from the gateway. Create a dedicated project and key pair for gateway traffic so you can rotate them without touching application teams, and store the secret in your secrets manager rather than in a declarative file kept in Git. Ask who owns key rotation and where the keys are recorded.

Network and certificate path

Gateway nodes must open outbound HTTPS to Langfuse, which means firewall rules, proxy settings and any private DNS must allow that path in your environment. If Langfuse uses an internal certificate authority, the gateway's trust store must include that authority, or the exporter will fail its TLS handshake. Test from each node type, including Kubernetes pods and data planes in separate networks.

Gateway configuration management

Decide how plugin settings reach each gateway. DB-less mode takes configuration from declarative files that can live in Git, and decK syncs those files to open-source and Enterprise gateways. Traditional mode with a database supports database-dependent plugins, so confirm which mode you run before you choose where the OpenTelemetry and AI Proxy settings are stored and reviewed.

decK docs

Configuring the AI Proxy and OpenTelemetry plugins step by step

This sequence takes a Kong gateway from a fresh configuration to one where each model call through a configured route produces a Gen AI trace in your self-hosted Langfuse. Each step ends with a check, so you can fix a problem before adding the next layer. Keeping the result in version-controlled files makes the setup reviewable and repeatable.

  1. Confirm the Kong version and deployment mode

    The platform owner confirms that the Kong Gateway release supports the AI Proxy plugin, which needs version 3.6 or later, and that the bundled OpenTelemetry plugin is available in the edition you run. The open-source repository's newest release line is 3.9, so confirm the edition and version with Kong before you commit to one. For a file-driven setup, DB-less mode takes its configuration from declarative files that can be kept in Git. Done when kong version reports a release at or above 3.6 and the gateway starts cleanly in your chosen mode.

  2. Define the provider and model route with AI Proxy

    Add the AI Proxy plugin to the route that clients call, then set the upstream provider, the model and the credential the gateway uses to reach it. Supported providers include OpenAI, Azure OpenAI, Anthropic, Gemini and OpenAI-compatible servers such as vLLM, and the plugin handles request types such as chat completions and embeddings. Keep provider keys in a secret store and out of application code. Done when a direct call through the route returns a model response, which confirms the route works before any tracing is added.

  3. Keep the configuration in decK files

    Export the running configuration with decK's dump command so the plugin settings become a reviewable file, then store that file in version control. decK is Apache-2.0 licensed and syncs declarative files to open-source and Enterprise Kong Gateway as well as to Konnect, so the same files can move between environments. Reference the Langfuse keys as placeholders or secret references so the repository holds no literal secrets. Done when a second deck gateway dump run against the same gateway shows no differences from the committed file that you did not expect.

  4. Enable the OpenTelemetry plugin with the Langfuse endpoint

    Enable Kong's OpenTelemetry plugin and point its traces endpoint at the /api/public/otel path on your self-hosted Langfuse host, using OTLP over HTTP. Kong sends the Gen AI span attributes straight to Langfuse, so this path needs no OpenTelemetry Collector. Use a host name that your gateway can reach through your network controls. The Langfuse Kong guide lists the exact setting names. Done when the plugin appears in the configuration dump with the endpoint set and the gateway reloads without errors.

  5. Add the Langfuse authentication headers

    Set the authentication header the endpoint requires, built from the public and secret keys of the Langfuse project that should receive gateway traffic. Load the secret key from your secret store rather than typing it into the file. Confirm the header format and how the key pair is encoded against the Langfuse Kong guide before you use it, since Langfuse defines that encoding. Done when the configuration dump shows the header as a reference and not as plain text, and the gateway still reloads cleanly.

  6. Send a test request through the gateway

    From a client that can reach the gateway, send one chat completion request to the configured route and record the time and any request identifier the gateway returns. Use a prompt you control and a short expected reply so the trace is easy to recognize. Tag the request with a test user or a marker value so it is simple to find later. Done when the gateway returns the model's response with a success status, which shows the traffic path works before you inspect the trace.

  7. Confirm the Gen AI trace in Langfuse

    Open the project in your self-hosted Langfuse and locate the trace from the test request, using the time and identifier you recorded. Check which attributes arrived, such as the model name and any token usage fields, against the Langfuse Kong guide. If the trace is missing, check the endpoint path, the authentication header and whether the plugin is enabled on the route you called. Done when the trace appears with the expected model and provider, and the working settings are committed to your decK files.

Which LLM providers and request types Kong traces cover

The Langfuse Kong integration documents coverage for the hosted providers handled by Kong's AI Proxy plugins: OpenAI, Azure OpenAI, Anthropic, Cohere, Gemini and Mistral. For these upstreams, the gateway emits Gen AI span attributes for traffic it handles, and the bundled OpenTelemetry plugin exports them over OTLP/HTTP to Langfuse's OpenTelemetry endpoint. Applications keep calling the gateway and do not need a provider SDK change to appear in traces.

  • Provider list: OpenAI, Azure OpenAI, Anthropic, Cohere, Gemini and Mistral are named in the Langfuse Kong documentation as covered providers.
  • Azure OpenAI deployments: Confirm that each Azure deployment name your applications call maps to a model name Langfuse can price, since deployment naming often differs from the base model.
  • Model and token fields: Check that the model name, input tokens and output tokens populate for each provider, because these drive cost views in Langfuse.
  • Provider versions: Re-test after provider API changes, since a provider can change response fields that the span attributes depend on.
  • Gateway version: AI Proxy requires Kong Gateway 3.6 or later, and some features need 3.10 or 3.11, so confirm the version against the plugin documentation.

Before go-live, send a known request to each hosted provider through the gateway and confirm that the trace, model and token counts appear in Langfuse as expected.

What applications no longer need to instrument

Once LLM traffic passes through Kong, the application teams behind covered calls can remove their per-service tracing code for those calls. The Gen AI spans come from the AI Proxy plugins, and Kong's OpenTelemetry plugin exports them over OTLP/HTTP straight to Langfuse's /api/public/otel endpoint, so no collector sits in the path. Model, provider, token and latency attributes are captured at the gateway for every provider the AI Proxy plugins handle, including OpenAI, Azure OpenAI, Anthropic, Cohere, Gemini, Mistral and OpenAI-compatible upstreams such as vLLM. Before removing SDK wrappers, confirm with your platform team which routes and consumers are actually configured with the AI Proxy plugin, since a route without it produces no gateway spans.

Gateway spans do not know who the user is or which conversation a request belongs to. Identifiers such as user ID, session ID, tenant, feature name and prompt version come from the application, so teams that want them on traces must still send them, either as request headers that the gateway passes through to the telemetry or through their own instrumentation. Decide this list before cutover, because a gateway-only trace with no user or session attribute is hard to attribute in Langfuse's per-user cost and session views. Also confirm with Kong's documentation which request metadata the OpenTelemetry plugin forwards in your version.

Two limits remain. Calls that bypass the gateway, such as direct provider SDK calls from a service that still holds provider keys, produce no gateway spans and need their own instrumentation or a network control that forces traffic through Kong. Attributes only the application knows, such as the business outcome of a call, retrieval context in a RAG pipeline or a human score, stay application work. Plan an inventory of egress paths and a short test that sends one request per consumer through the gateway and checks that a trace with the expected attributes appears in Langfuse.

How Gen AI span attributes map to Langfuse traces

This table compares each kind of data a Kong AI Proxy request produces with where it lands in Langfuse, such as observations, generations, usage, cost and trace metadata. Read it as a checklist to confirm during a pilot, since exact attribute names depend on your Kong version and the Langfuse Kong integration page. The main takeaway is that model, provider and token fields drive cost reporting, while consumer and route context must be confirmed before you rely on it for per-team analysis.

Data from KongWhere it lands in LangfuseWhat to confirm before go-live
Model name and providerGeneration model and provider fields, used to match pricingConfirm the model string matches your Langfuse model definitions for each upstream
Prompt and completion tokensGeneration usage fields, which feed token totalsCheck that streamed responses report usage, since some providers omit it
CostCost fields calculated from usage and model pricingConfirm whether Langfuse or Kong calculates cost for your providers and models
Request and response contentGeneration input and output, only where Kong is configured to capture itDecide capture settings with your privacy team before enabling content export
Latency and timingObservation start and end times, shown as span durationVerify timestamps align across Kong and application spans if both report
Consumer, route and serviceTrace metadata or tags for filtering by team, key or endpointConfirm attribute names for consumer and route in your Kong version before building dashboards
Provider coverage (OpenAI-compatible upstreams such as vLLM)Generations appear with the provider label Kong reportsTest each upstream you route, including self-hosted models, with a sample request

Securing the gateway-to-Langfuse telemetry path

Once Kong exports Gen AI spans to Langfuse, the gateway becomes a central point where prompts, completions and credentials pass. The cards below cover the controls that protect that path: credentials, what gets captured, transport, network reach and who can change the configuration. Each one has a check you can run before traffic goes live.

Keep Langfuse keys out of plugin config

The OpenTelemetry export needs a Langfuse public and secret key pair, sent as an Authorization header. Place that header value in your secret store and reference it from Kong rather than writing it into declarative files that sit in Git. Check that the Kong Admin API and any deck gateway dump output do not expose the header in plain text, and plan rotation so a key change does not require editing every route.

Langfuse Kong docs

Limit prompt and completion capture

Full prompt and completion content is what makes traces useful, and it is also where personal data, customer records and secrets end up. Decide per route which requests may carry content into traces, and confirm with the Kong AI Proxy documentation which Gen AI attributes are emitted for each request type. Routes that handle regulated data should capture usage and latency only, until a review approves content capture.

Encrypt the gateway-to-Langfuse hop

Langfuse's OpenTelemetry endpoint is reached over HTTP, so the connection from Kong to Langfuse should be TLS-protected end to end. Use an HTTPS address for the Langfuse host, verify the certificate chain that Kong trusts, and confirm that any internal certificate authority is included in the gateway trust store. Test with a failing certificate on purpose to confirm spans are refused rather than sent without verification.

Restrict egress from the gateway

Kong nodes that handle LLM traffic need outbound rules for model providers and for the Langfuse host, and should have nothing else. Allow only the Langfuse hostname and port to the telemetry destination, and confirm which provider endpoints the AI Proxy plugins call. A deny-by-default egress policy also reveals misconfigured routes that would otherwise send telemetry to an unexpected destination.

Review who can edit plugin configuration

Anyone who can change the OpenTelemetry plugin can redirect spans to another host, turn on content capture or remove the export entirely. Limit write access to the Admin API, Konnect or your GitOps repository to named platform owners, require review for changes to plugin settings, and log configuration changes. Confirm which roles your Kong deployment model supports before relying on them.

Plan masking and retention in Langfuse

Gateway-side limits reduce what reaches Langfuse, but traces that do arrive still need retention limits and masking of sensitive fields. Langfuse's data retention policies, audit logs and server-side data masking need an Enterprise license key on a self-hosted instance. Ask whether your compliance scope needs those features before go-live, or document the gateway-side limits as the compensating control.

Langfuse license key docs

Request flow from applications through Kong to Langfuse

The flow starts when an application sends a chat or completion request to the Kong AI Gateway instead of directly to a model provider. Kong's AI Proxy plugin forwards the request to the chosen provider, such as OpenAI, Anthropic or a vLLM endpoint, and emits Gen AI span attributes for that traffic. Kong's OpenTelemetry plugin then exports those spans over OTLP/HTTP straight to the Langfuse OpenTelemetry endpoint, with no collector in between. Check that the gateway and Langfuse sit inside the same trust boundary, and that the export path and credentials are the ones you reviewed.

Applications reach models through Kong, which exports Gen AI spans directly to self-hosted Langfuse.

Why Kong traces are missing or incomplete in Langfuse

This table lists the failures that most often leave Kong AI Gateway traffic out of Langfuse or only partly captured, with the cause and fix for each. Work through the rows in order when traces do not appear, then check the coverage rows when only some requests show up.

SymptomLikely causeFix
No traces at all from KongOTLP endpoint path or host is wrong in the OpenTelemetry plugin, for example the base URL without the /api/public/otel pathSet the plugin endpoint to your Langfuse host plus /api/public/otel and confirm the host resolves from the Kong nodes
Export requests rejectedLangfuse public or secret key missing from the Authorization header, or the Basic value is malformedBuild the header from the project's public and secret keys as the Langfuse Kong guide describes, then resend a test request and check the response code
Export fails only over HTTPSKong nodes do not trust the certificate chain of a private or internal Langfuse hostAdd the internal CA to the trust store used by Kong, or the plugin's TLS settings, and retest with the same host name in the endpoint
Some requests traced, others notThe OpenTelemetry plugin or AI Proxy plugin is scoped to certain services or routes only, so other routes never emit spansCompare the plugin scope with the routes that carry LLM traffic and apply the configuration at the right service, route or global level
Spans appear without model or token dataAI Proxy plugin ordering on the route places it after a plugin that rewrites or short-circuits the request, or the plugin is not on the route at allReview plugin order on each route, keep the AI Proxy plugin in the request path that reaches the upstream, and send one test call per route
A provider's calls are missingThe provider is not one the AI Proxy plugin handles in your Kong version, or the upstream is an OpenAI-compatible server configured as a different providerConfirm the provider against the AI Proxy plugin documentation and configure OpenAI-compatible upstreams such as vLLM with the matching model and endpoint settings
Some request types missingOnly chat or completion calls are tested, while embeddings, files, batches or audio use request types that need separate checksTest each request type your applications send through Kong and confirm which ones produce Gen AI spans in Langfuse
AI Proxy features fail or are absentKong Gateway is older than the release the feature needs, since AI Proxy needs 3.6 or later and some features need 3.10 or 3.11Check the running Kong version, plan an upgrade to a release that supports the features you need, and confirm the feature in the plugin docs for that version
Load-balanced traffic partly untracedAI Proxy Advanced is used on a Kong edition or version that does not include it, so the configuration is not applied as expectedConfirm the edition and version that include AI Proxy Advanced (Kong Gateway 3.8 or later per the plugin docs) before relying on it for routing

Questions teams ask before connecting Kong to Langfuse

Which Kong edition do we need before we connect it to Langfuse?

Settle the edition first, because it decides what you can run and who supports it. The Kong Gateway open-source repository is Apache-2.0 licensed and its newest release line is 3.9, with 3.9.4 published on October 12, 2026. Kong's version support policy covers only Kong Gateway Enterprise, so the open-source edition has no published support window. Kong's pricing page states that fully self-hosted gateways with a local control plane and data plane belong to the commercial Kong Gateway Enterprise offering. Also confirm whether you need AI Proxy Advanced, which is documented as Enterprise-only and needs Kong Gateway 3.8 or later. Confirm these points with Kong before you choose a version.

Does the Kong integration need an OpenTelemetry Collector in the middle?

No. Kong's bundled OpenTelemetry plugin can export Gen AI span attributes over OTLP/HTTP directly to Langfuse's OpenTelemetry endpoint, so no collector is required for this path. A collector can still be worth adding if you already run one and want to fan out telemetry to several backends, apply sampling, or redact fields centrally. Decide this early, because it changes where configuration lives and who owns it. Langfuse documents this setup in its Kong integration guide.

Which LLM providers does Kong tracing cover?

The Langfuse Kong integration covers every provider handled by the AI Proxy plugins. The supplied documentation lists OpenAI, Azure OpenAI, Amazon Bedrock, Anthropic, Gemini, Vertex AI, Cohere, Mistral, Hugging Face, Ollama and vLLM, and the plugin also handles several request types beyond chat completions, including embeddings, files, batches, responses, audio and image generation. Coverage applies only to traffic that passes through Kong's AI Proxy plugins. Traffic that reaches a provider directly, bypassing the gateway, will not appear in Langfuse. Test each provider and request type you use, because the exact span content can differ by provider.

What do applications stop instrumenting once Kong sends traces?

Applications that call LLMs only through the gateway no longer need per-application tracing code for the calls Kong handles, such as model, token and latency capture on each request. Teams usually keep application-level instrumentation for business context that Kong cannot see, such as user identity, session IDs, retrieval steps and tool calls inside an agent. Plan that split per application, and check which headers or attributes your applications must still send so traces stay linked to the right user or session.

What does the work need from our side?

You need access to the Kong control plane or configuration source, whether that is declarative files in Git, the Admin API in traditional mode, or Konnect, depending on your topology. You also need a Langfuse project with its public and secret keys issued, and a Langfuse host reachable from Kong's data plane. Network approvals are often the slowest item: confirm the egress path from every Kong node to the Langfuse OTLP endpoint, including proxies, firewall rules and TLS trust. Named owners for the gateway, the Langfuse instance and the network should agree on change windows before work starts.

What drives the cost and effort of this work?

The main drivers are the shape of your Kong footprint and how many providers and request types must be verified. Cost rises with the number of gateway nodes and clusters, the topology (DB-less with declarative files, hybrid, or traditional with PostgreSQL), the number of AI routes and providers, and the depth of testing across them. Ongoing cost comes from upgrading Kong and Langfuse on their own cadences, retesting span output after each change, and keeping the decK or declarative configuration in sync. Ask any partner for a quote that lists each of these items separately, with the gateway and Langfuse upgrade work included or excluded in writing.

Can our internal team set this up alone?

A team already running Kong and self-hosted Langfuse can usually do the basic OTLP export themselves, because the Langfuse documentation describes a direct path. Outside help tends to add value in the parts that are less obvious: testing across each provider and request type you use, aligning the gateway configuration with your change process, locking down network paths, and writing the runbook for upgrades on both sides. Check whether your team has in-house experience with Kong's configuration model and with Langfuse's ClickHouse and PostgreSQL operations, since trace volume will depend on that platform too.

How DeployOpen scopes and delivers the Kong and Langfuse tracing work

DeployOpen scopes this work as a fixed-scope engagement, with the written agreement fixing which Kong gateways, AI Proxy routes and upstream providers are in scope, which self-hosted Langfuse instance receives the traces, and what counts as finished. Before any configuration starts, the scope should name the Kong edition and version in use (the open-source 3.9 line and Kong Gateway Enterprise are different offerings with different plugin sets, so confirm which one you run), the provider list the AI Proxy plugins must cover, and whether AI Proxy Advanced load balancing is in use, since that plugin needs an Enterprise offering. DeployOpen configures the Kong OpenTelemetry plugin to export over OTLP/HTTP to your Langfuse /api/public/otel endpoint inside your own infrastructure, and the Langfuse side stays in your cloud account, data center or air-gapped network.

Delivery covers two tracks. On the Kong side, the work includes plugin configuration, the declarative configuration source (for example files kept in Git and synchronized with decK, or a traditional database-backed setup), and the credentials Kong uses to reach Langfuse, which should be stored and rotated under your secrets process. On the Langfuse side, it covers project and key setup, and confirming the Langfuse deployment, sizing and backups are in place. Trace coverage testing then sends representative requests through each provider route and checks the span attributes, token counts, model names and any user or session fields in Langfuse against an agreed list. Teams that also send application traces should agree in writing how gateway spans and application spans will be correlated, so duplicate or orphaned traces do not appear.

The handover package should include the Kong configuration as it was deployed, the exact Kong and Langfuse versions tested, a runbook for rotating the Langfuse keys, the coverage test results, and the known gaps. Ask for each of these in the written scope. Optional retainer support can then cover Kong and Langfuse upgrades, new providers or routes, and periodic coverage checks, since Kong and Langfuse release on their own schedules and a plugin or schema change can silently stop spans from arriving. Ask any partner to confirm in writing who is responsible for each of these tasks after go-live.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.