openinference-instrumentation-openai to capture spans in Arize AX.
This page instruments OpenAI SDK calls to Alibaba Cloud Model Studio’s OpenAI-compatible endpoint. It is not a separate Qwen-specific OpenInference instrumentor.
Prerequisites
- Python 3.9+
- An Arize AX account (sign up)
- A DashScope or Alibaba Cloud Model Studio API key
- The OpenAI-compatible base URL for your Model Studio region or workspace
Launch Arize
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key. You will set them as
ARIZE_SPACE_IDandARIZE_API_KEYbelow.
Install
Configure credentials
Setup tracing
Run Qwen
Expected output
Verify in Arize
- Open your Arize AX space and select project
qwen-tracing-example. - You should see a new trace within ~30 seconds containing a
ChatCompletionLLM span with prompt, response, model, token, and latency metadata. - If no traces appear, see Troubleshooting.
Check from the skill, CLI, or SDK
Confirm spans are actually reaching your Arize AX project. Use whichever fits your workflow — the skill and CLI work for any framework; the SDK check is shown for each language.- Arize skill (agent)
- AX CLI
- SDK
Install the Arize Skills plugin and let your coding agent check for you:Then prompt your agent:
Use the arize-trace skill to export and analyze recent traces from my project. Confirm spans are arriving, and summarize any errors or latency issues.
Troubleshooting
- No traces in Arize. Confirm
ARIZE_SPACE_IDandARIZE_API_KEYare set in the same shell that runsexample.py. - Qwen spans missing but other spans present.
OpenAIInstrumentor().instrument(...)must run before anyimport openai. 401from Model Studio. Use your DashScope or Model Studio API key, not your OpenAI or Arize API key.- Endpoint or model errors. Confirm
QWEN_BASE_URLmatches your Model Studio region or workspace and replaceqwen-pluswith an available Qwen model.