Ratel Docs
Get startedSend data

OpenTelemetry

Point any OpenTelemetry exporter at the Ratel Platform. No Ratel SDK needed.

The Platform ingests standard OTLP. Any agent that emits LLM spans can send them, in any language.

What you need

  • A project API key, exported as RATEL_API_KEY. See the Quickstart.
  • An OTLP/HTTP exporter. Protobuf and JSON both work. gRPC does not.
SettingValue
Traces endpointhttps://cloud.ratel.sh/v1/traces
Logs endpointhttps://cloud.ratel.sh/v1/logs (content events, optional)
HeaderAuthorization: Bearer <your-key>
Protocolhttp/protobuf or http/json

Configure with environment variables

Most OpenTelemetry SDKs read these at startup:

export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://cloud.ratel.sh/v1/traces"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer%20$RATEL_API_KEY"
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"

The space after Bearer is URL-encoded as %20.

Or configure in code

One span, nothing to install:

curl -i https://cloud.ratel.sh/v1/traces \
  -H "Authorization: Bearer $RATEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "resourceSpans": [{ "scopeSpans": [{ "spans": [{
        "traceId": "'"$(openssl rand -hex 16)"'", "spanId": "'"$(openssl rand -hex 8)"'",
        "name": "chat gpt-4o", "kind": 3,
        "startTimeUnixNano": "'"$(date +%s)"'000000000",
        "endTimeUnixNano": "'"$(date +%s)"'900000000",
        "attributes": [
          { "key": "gen_ai.operation.name", "value": { "stringValue": "chat" } },
          { "key": "gen_ai.provider.name", "value": { "stringValue": "openai" } },
          { "key": "gen_ai.request.model", "value": { "stringValue": "gpt-4o" } },
          { "key": "gen_ai.usage.input_tokens", "value": { "intValue": "1200" } },
          { "key": "gen_ai.usage.output_tokens", "value": { "intValue": "80" } }
        ] }] }] }] }'
npm install @opentelemetry/api @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-proto
otel.mjs
import { NodeSDK } from "@opentelemetry/sdk-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";

const sdk = new NodeSDK({
  serviceName: "my-agent",
  traceExporter: new OTLPTraceExporter({
    url: "https://cloud.ratel.sh/v1/traces",
    headers: { Authorization: `Bearer ${process.env.RATEL_API_KEY}` },
  }),
});
sdk.start();
process.once("beforeExit", () => sdk.shutdown());

Import it first (node --import ./otel.mjs app.mjs), then add an instrumentation for your model client.

pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
otel.py
import os
from opentelemetry import trace
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter

provider = TracerProvider(resource=Resource.create({"service.name": "my-agent"}))
provider.add_span_processor(
    BatchSpanProcessor(
        OTLPSpanExporter(
            endpoint="https://cloud.ratel.sh/v1/traces",
            headers={"Authorization": f"Bearer {os.environ['RATEL_API_KEY']}"},
        )
    )
)
trace.set_tracer_provider(provider)

Import it at startup, then add an instrumentation for your model client, for example opentelemetry-instrumentation-openai-v2.

Other emitters work the same way: Vercel AI SDK, OpenInference and anything that follows the OpenTelemetry GenAI semantic conventions.

What the Platform reads

You getFromNeeds
Tokens, cost, model, latencygen_ai.usage.*, gen_ai.request.model, gen_ai.provider.nameNothing extra
Tool callsexecute_tool spans and tool-call messagesNothing extra
Unused toolsgen_ai.tool.definitionsYour instrumentation sends the offered tools
Context breakdown: user input, history, tools, skills, memoryMessage contentContent capture on

Content capture

Content capture sends prompts, responses and tool arguments. It is off by default. Turn it on only if that is acceptable for your data:

export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_AND_EVENT
  • SPAN_AND_EVENT puts content on the span and as log events. Send the events to /v1/logs.
  • Without content, totals stay exact and the breakdown counts everything as user input.

Limits and errors

  • Up to 4 MB per request.
  • Monthly events depend on your plan. See Plans and limits.
StatusMeaning
202Accepted. The body counts the spans and model calls stored.
401Missing, invalid or revoked API key.
413Request over 4 MB. Lower your batch size.
415Content type is not protobuf or JSON.
429Monthly limit or rate limit reached.

Check it worked

  1. The curl call returns 202 with {"accepted":1,"calls":1,"spans":1}.
  2. In your project, open Monitor > Traces and pick the Spans tab. Each model call shows with its model, tokens and cost.
The Traces page with sessions over time and the list of runs

On this page