openinference-instrumentation-openai to capture spans in Phoenix.
This page instruments OpenAI SDK calls to Alibaba Cloud Model Studio’s OpenAI-compatible endpoint. It is not a separate Qwen-specific OpenInference instrumentor.
Install
Setup
Add your DashScope or Model Studio API key and the OpenAI-compatible base URL for your region as environment variables:register function:
Run Qwen
Observe
Now that you have tracing set up, all invocations of the OpenAI client pointed at Qwen will be streamed to your running Phoenix for observability and evaluation. Each call appears as aChatCompletion LLM span with the prompt, response, model name, token usage, and latency.
Common Issues
- Spans missing:
register(..., auto_instrument=True)must run before your application sends requests, andopeninference-instrumentation-openaimust be installed in the same environment 401from Model Studio: Use your DashScope or Model Studio API key, not an OpenAI key- Endpoint or model errors: Confirm
QWEN_BASE_URLmatches your Model Studio region or workspace, and replaceqwen-pluswith an available Qwen model

