The SDK provides seamless instrumentation for the OpenAI Python client.Documentation Index
Fetch the complete documentation index at: https://docs.agentbasis.co/llms.txt
Use this file to discover all available pages before exploring further.
Setup
Enable instrumentation with a single function call. This automatically tracks all subsequent calls to bothOpenAI and AsyncOpenAI clients.
A single
instrument() call instruments both synchronous and asynchronous clients. You don’t need to call it twice.Usage
Once instrumented, use the OpenAI client as you normally would. The SDK automatically captures all call data.Synchronous
Asynchronous
Streaming
Streaming responses are supported for both sync and async. The trace is recorded once the stream completes.Sync Streaming
Async Streaming
Captured Data
The integration automatically records:| Field | Description |
|---|---|
gen_ai.system | openai |
gen_ai.request.model | Model name (e.g., gpt-4) |
gen_ai.prompt | Input messages |
gen_ai.completion | Response content |
gen_ai.usage.prompt_tokens | Prompt token count |
gen_ai.usage.completion_tokens | Completion token count |
duration | Request latency |

