Skip to main content
Available via: Portkey’s experimental OpenTelemetry export on Enterprise and self-hosted Portkey. This is not a Zespan SDK wrapper, see Send traces from any OTel-instrumented app for how the endpoint works.
Portkey can export a trace for every request it handles. Point that export at Zespan and every call that passes through the gateway is stored with its model, provider and token counts, without changing the apps that call it.

Setup

1

Turn on Portkey's OpenTelemetry export

Portkey’s export is experimental and is switched on with environment variables of your Portkey deployment (Enterprise or self-hosted): EXPERIMENTAL_GEN_AI_OTEL_TRACES_ENABLED=true, the endpoint in EXPERIMENTAL_GEN_AI_OTEL_EXPORTER_OTLP_ENDPOINT and headers in EXPERIMENTAL_GEN_AI_OTEL_EXPORTER_OTLP_HEADERS (comma-separated key=value). These are the names in Portkey’s documentation; check them for your version.
2

Set the destination

Use https://api.zespan.com as the base URL: Portkey appends /v1/traces itself. Send your project key in a header, x-api-key=zsp_... (or Authorization=Bearer zsp_...). Portkey sends JSON, which Zespan accepts.
3

Verify

Send one request through Portkey, then open Settings → Instrumentation → Gateway and OTLP data and press Refresh. The source should appear with tokens and span kind near 100%. See Instrumentation.

What gets captured

Attribute names come from Portkey’s published documentation and can change between versions. Use the Gateway and OTLP data card to see what actually arrives. Portkey documents the export as experimental.
Gateway identity metadata (for example an API key id or workspace label) is not stored, and prompt and answer text follows your project’s capture and redaction settings. See AI gateways and Security.

Using the SDK too

If your app also uses the Zespan SDK for the same call, Zespan can count its tokens and cost once when merging is on (see the linked section). Portkey documents the provider’s response id on its span (gen_ai.response.id), so the two rows can be matched by that id without an SDK setting. Portkey does not document an inbound traceparent, so matching relies on the response id. See Using the SDK too.

Next steps