respan-instrumentation-openai
Respan instrumentation plugin for direct OpenAI 3.x SDK usage. The native,
Traceloop-free integration patches sync and async Chat Completions, Responses,
Completions, and Embeddings resources. Chat and Responses structured-output
parse methods, streaming, tools, usage, and provider failures are included.
Configuration
1. Install
pip install respan-instrumentation-openai
2. Set Environment Variables
| Variable | Required | Description |
|---|---|---|
RESPAN_API_KEY |
Yes | Your Respan API key. Authenticates both proxy and tracing. |
RESPAN_BASE_URL |
No | Defaults to https://api.respan.ai/api. |
Use OPENAI_API_KEY and optionally OPENAI_BASE_URL when calling OpenAI
directly. A Respan gateway deployment may instead use its gateway credential
and OpenAI-compatible base URL.
Quickstart
3. Run Script
import os
from openai import OpenAI
from respan import Respan
from respan_instrumentation_openai import OpenAIInstrumentor
respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai")
respan = Respan(
api_key=respan_api_key,
base_url=respan_base_url,
instrumentations=[OpenAIInstrumentor()],
)
client = OpenAI(
api_key=respan_api_key,
base_url=f"{respan_base_url}/api/openai",
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
respan.flush()
respan.shutdown()
4. View Dashboard
After running the script, traces appear on your Respan dashboard.
Further Reading
See respan-example-projects/python/tracing/openai-sdk for deterministic
OpenAI 3.x examples. Set RESPAN_OPENAI_LIVE=1 to opt into a configured live
provider; deterministic mode still executes the real OpenAI SDK request and
response parsing layers through an in-process HTTP transport.
Metadata
Release files for respan-instrumentation-openai 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| respan_instrumentation_openai-1.2.2.tar.gz | 14.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| respan_instrumentation_openai-1.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.8 kB
Release files / respan_instrumentation_openai-1.2.2.tar.gz
| Download URL | respan_instrumentation_openai-1.2.2.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08f9aefc22a5e57e85b7699699f37f01ef2ac3dd0480bbebdee96193ee14c085
|
|
BLAKE2b-256 checksum How to use checksums |
06c01a66a7233ad79c46382c80259799cfa651da2fc18e69533b2c547b96fc7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.
Transparency logRelease files / respan_instrumentation_openai-1.2.2-py3-none-any.whl
| Download URL | respan_instrumentation_openai-1.2.2-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5401180098dfab9bb3feddf0a37cfe3668fa41e39f3f59decc09ce8d2807045
|
|
BLAKE2b-256 checksum How to use checksums |
d130b08b0a3ca287c55e1d97e248aa9e7cf56e535e7d42da033f3b8b46483124
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.
Transparency log