For the complete documentation index, see llms.txt. This page is also available as Markdown.

OTLP Integration

Revenium accepts OTLP (OpenTelemetry Protocol) data directly from your instrumented applications. If your app already emits telemetry via an OTLP exporter—using LangChain, the OpenAI Python SDK with OTel instrumentation, or your own custom spans—you can point it at Revenium with a few lines of configuration and start seeing AI usage data immediately.

This page covers Revenium-specific configuration. It assumes you already understand OTLP and have an exporter set up.


Endpoints

Revenium accepts both OTLP/HTTP and OTLP/gRPC.

OTLP/HTTP

Path
Accepts

https://api.revenium.ai/meter/v2/otlp/v1/traces

Traces (JSON or protobuf)

https://api.revenium.ai/meter/v2/otlp/v1/logs

Logs (JSON or protobuf)

https://api.revenium.ai/meter/v2/otlp/v1/metrics

Nothing: answers 410 Gone (see below)

https://api.revenium.ai/meter/v2/otlp

Unified (traces + logs in one request; metrics in the same request are discarded)

Both application/json and application/x-protobuf content types are accepted.

OTLP/gRPC

Host
Port
Service

api.revenium.ai

4317

opentelemetry.proto.collector.trace.v1.TraceService

The gRPC endpoint accepts traces only. For logs, use the HTTP endpoints.

Direct Metering Endpoints

If you are not using OTLP, Revenium also accepts direct metering payloads:

Endpoint
Purpose

https://api.revenium.ai/meter/v2/ai/completions

LLM completions, tokens, and cost

https://api.revenium.ai/meter/v2/tool/events

Agent tool executions

https://api.revenium.ai/meter/v2/ai/images

Image generation usage

https://api.revenium.ai/meter/v2/ai/audio

Audio generation or transcription usage

https://api.revenium.ai/meter/v2/ai/video

Video generation usage

https://api.revenium.ai/profitstream/v2/api/jobs/{jobId}/outcome?teamId=...

Terminal job outcomes

The /meter/v2/... endpoints are metering-ingest endpoints for usage events. The /profitstream/v2/api/... endpoint is the Jobs API used to close an already-metered job with its terminal business outcome. Use a metering key (rev_mk_*) for ingest-only calls and a write-scope key (rev_sk_*) when reporting outcomes or managing Jobs resources.

For choosing between SDKs, OTLP, and direct API calls, see Integration Options.


Authentication

For both OTLP/HTTP and OTLP/gRPC, your Revenium API key can be sent as either x-api-key or Authorization: Bearer. OTLP ingest requires a metering key (rev_mk_*) — if your workflow also reports business outcomes or manages Revenium resources, use a write-scope key (rev_sk_*) for those calls; see API Key Permissions.

or

For frameworks or SDKs that cannot set custom headers (e.g., some CLI tools), you can pass the API key as an OTLP resource attribute instead:

This travels inside the encrypted OTLP payload body and is secure over TLS. Note: this fallback is not available for OTLP/gRPC (interceptors run before message deserialization on the gRPC path).

Authentication priority is:

  1. x-api-key: <key> HTTP header

  2. Authorization: Bearer <key> header

  3. OTEL_RESOURCE_ATTRIBUTES=revenium.api_key=<key> for OTLP/HTTP only

Headers always win over the resource attribute. If no key is available in either place, the request is rejected before metering.

You can find your API key in the Revenium app under Integrations > SDK Setup.


Quick Start

1. Configure your OTLP exporter

Set the exporter endpoint and auth header. The exact env vars depend on your SDK, but the standard OpenTelemetry environment variables work with all OTel SDKs:

With a base endpoint the SDK appends /v1/metrics for its metrics signal, and Revenium answers that path with 410 Gone, so turn the metrics exporter off. If the app needs to keep exporting metrics to another backend, use the per-signal variables below instead.

If your framework uses separate endpoint vars for signals:

These variables apply only to traces and logs, so metrics keep whatever endpoint and headers the app already uses. If the app has no other metrics destination, set OTEL_METRICS_EXPORTER=none so the SDK does not try to export them; a metrics exporter left pointed at Revenium logs a 410 Gone error each interval.

2. Send a trace

Run your application normally. The OTel instrumentation in your app creates spans when AI calls are made, and the exporter sends them to Revenium.

Minimal OTLP/JSON trace shape:

3. See it in Revenium

Go to Logs > Transactions or Logs > Traces. If the span contained recognized GenAI attributes (see below), you'll see token counts, model, provider, and cost data populated automatically.


Supported Frameworks and SDKs

Revenium auto-detects the source based on resource attributes and instrumentation scope names. No special configuration in Revenium is required—just point your exporter at the endpoint.

Python: opentelemetry-instrumentation-openai

Python: opentelemetry-instrumentation-anthropic

Python: LangChain via OpenInference or OpenLLMetry

Both OpenInference and OpenLLMetry emit GenAI semantic convention spans. Configure the OTLP exporter as shown above; Revenium picks them up automatically.

Node.js: @opentelemetry/instrumentation-openai

Go SDK (gRPC)

OpenTelemetry Collector

If you're already running an OTel Collector, add Revenium as an exporter:


What Gets Captured Automatically

Revenium reads OpenTelemetry GenAI semantic conventions from your spans and log records. If your instrumentation library follows the spec, these fields populate automatically—no extra code required.

Token Counts

GenAI Attribute
Revenium Field
Notes

gen_ai.usage.input_tokens

Input tokens

Also accepts deprecated gen_ai.usage.prompt_tokens

gen_ai.usage.output_tokens

Output tokens

Also accepts deprecated gen_ai.usage.completion_tokens

gen_ai.usage.cache_read_input_tokens

Cache read tokens

Also accepts gen_ai.usage.cache_read_tokens

gen_ai.usage.cache_creation_input_tokens

Cache creation tokens

Also accepts gen_ai.usage.cache_creation_tokens

Model and Provider

GenAI Attribute
Revenium Field
Notes

gen_ai.response.model

Model

Preferred; falls back to gen_ai.request.model

gen_ai.provider.name

Provider

Also accepts deprecated gen_ai.system

gen_ai.request.model

Model (request)

Used when response model is absent

Operation Type and Finish Reason

GenAI Attribute
Revenium Field
Values

gen_ai.operation.name

Operation type

chat → Chat; embeddings → Embed; text_completion → Chat; generate_content → Chat

gen_ai.response.finish_reasons

Stop reason

Array; Revenium uses the first element — see mapping table below

Finish reason mapping:

gen_ai.response.finish_reasons value

Revenium stop reason

stop, end_turn

End

max_tokens, length

Token Limit

stop_sequence

End Sequence

content_filter

Error

tool_calls, function_call

End

(any other value)

End

Request Parameters

GenAI Attribute
Revenium Field
Notes

gen_ai.request.temperature

Temperature

Standard OTel attribute; captured automatically

gen_ai.response.id

System fingerprint

Response identifier from the model provider

Timing and Errors

Span start/end nanosecond timestamps (startTimeUnixNano, endTimeUnixNano) are used to populate request time, response time, and duration. Error details are read from exception.message (primary) and error.type (fallback). HTTP status codes are read from http.response.status_code.

Infrastructure Context

Standard OTel Attribute
Revenium Field

deployment.environment

Environment

cloud.region

Region

Span Hierarchy

traceId, spanId, and parentSpanId from spans are mapped to Revenium's trace, transaction, and parent transaction fields respectively. This powers the Trace Analytics dependency tree and waterfall visualizations.

Revenium skips spans with gen_ai.operation.name of execute_tool, invoke_agent, or create_agent — these are orchestration spans, not LLM calls. Only spans that represent actual model invocations are metered.


Attribute Precedence and Source Detection

Revenium resolves attribution values in this order:

Category
Attributes
Span override
Resource default

System fingerprint

revenium.system.fingerprint

Yes

Yes

Organization / product

revenium.organization.name, revenium.product.name

Yes

Yes

Subscriber

revenium.subscriber.id, revenium.subscriber.email, revenium.subscriber.credential.*

Yes

Yes

Agent and job

revenium.agent.name, revenium.task.type, revenium.trace.type, revenium.job.id

Yes

Yes

Squad

revenium.squad.id, revenium.squad.name, revenium.squad.role

Yes

Yes

Operational

revenium.operation.subtype, revenium.retry.number, revenium.request.stream

Yes

Yes

Revenium identifies GenAI spans using this detection chain:

  1. Span attribute gen_ai.provider.name

  2. Span attribute gen_ai.system

  3. Instrumentation scope names such as gen_ai.*, openai.*, anthropic.*, or opentelemetry.instrumentation.*

  4. Resource-level GenAI attributes

  5. If none match, the span is logged but not metered


Deep Attribution with revenium.* Attributes

Standard OTel tells you what happened — which model was called, how many tokens were used. revenium.* attributes tell Revenium why it happened and who it happened for. This is what enables per-customer, per-product, per-agent, and per-job cost attribution that goes beyond what the OTel spec captures.

Set these on spans or log records (record-level attributes take precedence over resource-level attributes, so you can set defaults at the resource level and override on individual spans).

System Fingerprint

revenium.system.fingerprint is one of Revenium's most powerful attribution tools. It lets you tag each AI call with an identifier that represents what configuration produced it — your system prompt version, your prompt template ID, your agent configuration hash, or any other identifier you use to distinguish one variant from another.

This is how you answer questions like: "Which version of my system prompt is more expensive?" or "Did my prompt optimization actually reduce costs?" Standard OTel has no equivalent.

Attribute
Revenium Field
Notes

gen_ai.response.id

System fingerprint

Populated automatically if your provider returns a response ID

revenium.system.fingerprint

System fingerprint

Use this to set your own fingerprint — overrides gen_ai.response.id when both are present

Use any value that uniquely identifies the configuration: a version string, a git SHA, a prompt template ID, or a hash of your system prompt content.

Organization and Product

Attribute
Revenium Field
Example

revenium.organization.name

Organization

"acme-corp"

revenium.product.name

Product

"document-summarizer"

revenium.subscription.id

Subscription

"enterprise-plan-q1"

Subscribers and Users

Attribute
Revenium Field
Example

revenium.subscriber.id

Subscriber ID

"user-12345"

revenium.subscriber.email

Subscriber email

"user@example.com"

revenium.subscriber.credential.name

Credential name

"api-key-prod"

revenium.subscriber.credential.value

Credential value

"pk-abc123"

Agents and Agentic Workflows

Attribute
Revenium Field
Example

revenium.agent.name

Agent

"support-agent-v2"

revenium.task.type

Task type

"summarize"

revenium.trace.type

Trace type

"rag-pipeline"

revenium.trace.name

Trace name

"support-ticket-resolution"

revenium.transaction.name

Transaction name

"retrieve-context"

Squads (Multi-Agent Teams)

Attribute
Revenium Field
Example

revenium.squad.id

Squad ID

"squad-billing"

revenium.squad.name

Squad name

"Billing Support Squad"

revenium.squad.role

Role in squad

"orchestrator"

Agentic Jobs

Attribute
Revenium Field
Example

revenium.job.id

Job ID

"job-20250312-001"

revenium.job.name

Job name

"nightly-report-gen"

revenium.job.type

Job type

"batch"

revenium.job.version

Job version

"2.1.0"

Other Fields

Attribute
Revenium Field
Notes

revenium.operation.subtype

Operation subtype

Free-form sub-classification

revenium.retry.number

Retry number

Integer; useful for tracking retry cost

revenium.request.stream

Is streamed

Boolean

revenium.middleware.source

Middleware source

Identifies the SDK or integration layer

Setting Attribution Attributes (Python Example)

You can also set defaults at the resource level so they apply to all spans from your service, and override on individual spans where needed:

Record-level (span) attributes always win over resource-level attributes when the same key is set at both levels.


OpenTelemetry Collector Fan-Out

Standard OpenTelemetry environment variables configure one endpoint per signal. To send the same telemetry to Revenium and another backend, place an OpenTelemetry Collector between your producers and the destinations. Applications that configure multiple exporters in code may not need a Collector.

Use a Collector when you need to:

  • send telemetry to more than one destination;

  • keep vendor credentials off application hosts;

  • apply different filtering or redaction rules per destination; or

  • change backends without reconfiguring every producer.

A Collector becomes part of your telemetry infrastructure. If Revenium is your only destination and you do not need centralized filtering, export directly to Revenium as described earlier on this page.

Architecture

A gateway Collector runs centrally and accepts telemetry from many producers. An agent Collector runs beside one producer. A gateway is usually the better fit for services, CI runners, and developer tools that all need the same routing policy.

Configuration requirements

Use the otlphttp exporter for the Revenium branch. Revenium accepts traces over OTLP/gRPC, but logs require OTLP/HTTP. Set the exporter endpoint to the unified base path shown below; the exporter appends /v1/traces or /v1/logs for each signal it sends to Revenium. Do not attach a metrics pipeline to the Revenium exporter: /v1/metrics answers 410 Gone, which the Collector treats as a permanent export failure.

Send the Revenium metering key in an exporter header. Do not put revenium.api_key in resource attributes when using a Collector. Resource attributes travel with the telemetry and may be copied to every destination.

The following example sends traces and logs to Revenium, and all three signals to a general observability backend. It removes two example identity attributes only from the observability branch. Adjust the redaction processors to match the attributes your producers emit and the policy for each destination.

REVENIUM_METERING_KEY must contain a metering key (rev_mk_*). See API Key Permissions for key scopes.

Each exporter has its own sending queue and retry policy. This prevents a temporary failure at one destination from immediately blocking exports to the other. Size the queues for your traffic and expected outage window. If a queue fills, that destination can still apply backpressure or drop data according to its configured behavior.

Route only selected telemetry to Revenium

The configuration above copies traces and logs to both destinations. If the gateway receives telemetry that Revenium should not ingest, use the routing connector to select the relevant records.

This example routes Claude Code logs to both destinations and sends other logs only to the observability backend:

Add a condition for each producer that should reach Revenium. The AI Assistant Data Reference lists the source identifiers emitted by supported assistants.

For Collector component syntax and deployment options, see the OpenTelemetry Collector configuration documentation.

Troubleshooting

Data not appearing in Revenium

Check that:

  1. Your API key starts with rev_mk_ and is in the correct format (rev_mk_<tenant>_<secret>).

  2. Your spans include at least one of the following so Revenium can route them to the correct mapper:

    • gen_ai.provider.name or gen_ai.system attribute (resource-level or span-level)

    • An instrumentation scope name starting with gen_ai, openai, anthropic, opentelemetry.instrumentation.openai, or opentelemetry.instrumentation.anthropic

  3. The exporter endpoint URL is correct and includes the full path (/v2/otlp/v1/traces, not /v2/otlp), unless your SDK sends all signals to a single base URL—in that case, use /v2/otlp.

  4. Your exporter sends traces or logs. Revenium rejects the metrics signal with 410 Gone, so an exporter that only sends metrics shows nothing in Revenium and logs export errors.

410 Gone errors from the exporter

The metrics signal is pointed at Revenium. Set OTEL_METRICS_EXPORTER=none, or route metrics to another backend with the per-signal endpoint variables. The error repeats once per export interval until the metrics exporter is turned off; traces, logs, and metering data are not affected.

Tokens showing as zero

Verify your instrumentation library emits gen_ai.usage.input_tokens and gen_ai.usage.output_tokens (or their deprecated equivalents gen_ai.usage.prompt_tokens / gen_ai.usage.completion_tokens) as numeric attributes on the span.

Tool call and agent orchestration spans are not appearing

This is expected behavior. Revenium filters out execute_tool, invoke_agent, and create_agent spans because they are not LLM calls. Only spans that represent actual model invocations produce metering records.


Last updated

Was this helpful?