Skip to main content
OpenLIT uses OpenTelemetry instrumentation to help you monitor Go applications built with OpenAI models. This includes tracking performance, token usage, costs, and how users interact with the application. The Go SDK wraps your OpenAI client with an InstrumentedClient that automatically emits traces and metrics for every API call — with zero changes to your application logic. The integration supports:
  • Chat completions (standard and streaming)
  • Embeddings
  • Image generation (dall-e-2, dall-e-3)

Get started

1

Install the Go SDK

Open your terminal and run:
2

Initialize OpenLIT

Add this once at the start of your application (e.g. in main()):
Replace YOUR_OTEL_ENDPOINT with the URL of your OpenTelemetry backend, such as http://127.0.0.1:4318 for a local OpenLIT deployment.
3

Create an instrumented client

Replace your existing OpenAI client creation with the OpenLIT instrumented client:
Optional configuration:
4

Use the client

Use the instrumented client exactly as you would a normal OpenAI client:Chat completion:
Streaming:
Embeddings:
Image generation:

What gets collected

Every call to the instrumented client automatically records: Metrics emitted:
  • gen_ai.client.token.usage — token usage histogram (input/output)
  • gen_ai.client.operation.duration — total operation duration
  • gen_ai.server.time_to_first_token — TTFT for streaming
  • gen_ai.client.operation.time_to_first_chunk — client-side TTFT
  • gen_ai.client.operation.time_per_output_chunk — per-chunk latency
  • gen_ai.server.request.duration — estimated server processing time

Go SDK Overview

Full configuration reference and setup guide

Configuration

Configure the OpenLIT SDK according to your requirements

Destinations

Send telemetry to Datadog, Grafana, New Relic, and other observability stacks