This library provides OpenTelemetry instrumentation for applications interacting with Together AI's endpoints. It is part of the OpenLLMetry project, which extends OpenTelemetry with AI-related instrumentations to capture LLM-specific data like prompts, completions, and token usage. The library is actively maintained with a rapid release cadence, with version 0.58.0 released on 2026-04-09.
pip install opentelemetry-instrumentation-togetherVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up OpenTelemetry to trace calls made to Together AI. It initializes a basic OpenTelemetry `TracerProvider` with a `ConsoleSpanExporter` to print traces directly to the console. The `TogetherAiInstrumentor` is then initialized and called to automatically instrument the Together AI client library. A mocked Together AI `Complete.create` call is included to make the example runnable without requiring an actual API key, though in a real scenario, you would provide your `TOGETHER_API_KEY` and make genuine API requests.
Refer to the OpenTelemetry documentation on semantic convention stability for migration guidance. You may need to update your instrumentation library, adjust custom attributes, or use the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable (e.g., `OTEL_SEMCONV_STABILITY_OPT_IN=http/dup` for HTTP changes) during migration to emit both old and new conventions temporarily.
To disable the logging of sensitive content, set the environment variable `IFTRACER_TRACE_CONTENT` to `false`. Example: `export IFTRACER_TRACE_CONTENT=false`.
Ensure you have `opentelemetry-sdk` installed and correctly configured your `TracerProvider`, added at least one `SpanProcessor` (e.g., `BatchSpanProcessor`), and an `SpanExporter` (e.g., `OTLPSpanExporter`, `ConsoleSpanExporter`). Refer to OpenTelemetry's official Python SDK documentation for a complete setup guide.