For the complete documentation index, see llms.txt. This page is also available as Markdown.

Instrument OpenAI Assistants

Recipe — instrument OpenAI / Assistants. Pointer to the SDK samples.

Canonical samples:

pip install 'layerlens[providers-openai]'

The OpenAI provider adapter emits one event per chat or embedding call: model.invoke (with parameters, token counts, latency, response_id, system_fingerprint, full messages); cost.record (USD computed from pricing table); tool.call (one per tool when present); policy.violation (on SDK error). Streaming responses emit a single consolidated model.invoke on completion.

Capture configs: CaptureConfig.minimal(), .standard(), or .full(). Circuit breaker opens after 10 consecutive sink failures (60s cooldown, silent drop while open).

See also

Last updated

Was this helpful?