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:
- Latest Version
- Specific Version
2
Initialize OpenLIT
Add this once at the start of your application (e.g. in Replace
main()):- Via Config Struct
- Via Environment Variable
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 durationgen_ai.server.time_to_first_token— TTFT for streaminggen_ai.client.operation.time_to_first_chunk— client-side TTFTgen_ai.client.operation.time_per_output_chunk— per-chunk latencygen_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

