Skip to main content
Qwen models are available through Alibaba Cloud Model Studio, which provides an OpenAI-compatible API mode. Configure the OpenAI Python client with your Model Studio endpoint and use 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

  1. Sign in to your Arize AX account.
  2. From Space Settings, copy your Space ID and API Key. You will set them as ARIZE_SPACE_ID and ARIZE_API_KEY below.

Install

Configure credentials

Alibaba Cloud may provide a workspace-specific or regional compatible-mode endpoint. Replace QWEN_BASE_URL with the endpoint shown in your Model Studio console if it differs.

Setup tracing

Run Qwen

Expected output

Verify in Arize

  1. Open your Arize AX space and select project qwen-tracing-example.
  2. You should see a new trace within ~30 seconds containing a ChatCompletion LLM span with prompt, response, model, token, and latency metadata.
  3. 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.
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_ID and ARIZE_API_KEY are set in the same shell that runs example.py.
  • Qwen spans missing but other spans present. OpenAIInstrumentor().instrument(...) must run before any import openai.
  • 401 from Model Studio. Use your DashScope or Model Studio API key, not your OpenAI or Arize API key.
  • Endpoint or model errors. Confirm QWEN_BASE_URL matches your Model Studio region or workspace and replace qwen-plus with an available Qwen model.

Resources

Alibaba Cloud Model Studio OpenAI Compatibility

OpenInference OpenAI Instrumentor

LLM Evaluation Guide

Agent Evaluation Guide