Skip to main content
OpenLIT uses OpenTelemetry instrumentation to help you monitor Go applications built with Anthropic models. This includes tracking performance, token usage (including prompt cache tokens), costs, and how users interact with the application. The Go SDK wraps your Anthropic client with an InstrumentedClient that automatically emits traces and metrics for every API call — with zero changes to your application logic. The integration supports:
  • Messages (standard and streaming)
  • Prompt caching token tracking (cache_creation_input_tokens, cache_read_input_tokens)
  • Tool use

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 Anthropic client creation with the OpenLIT instrumented client:
Optional configuration:
4

Use the client

Use the instrumented client exactly as you would a normal Anthropic client:Message:
Streaming:
Tool use:

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