Musterby Elitery
Integrations

Qwen (Alibaba DashScope)

Trace Alibaba Qwen calls in Muster via the DashScope OpenAI-compatible API.

Qwen models are hosted on Alibaba's DashScope platform with an OpenAI-compatible endpoint. Trace them in Muster by pointing the Muster OpenAI wrapper at the DashScope base URL.

Setup

%pip install langfuse openai --upgrade
import os

os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-lf-..."
os.environ["LANGFUSE_SECRET_KEY"] = "sk-lf-..."
os.environ["LANGFUSE_BASE_URL"] = "https://app.getmuster.io"
os.environ["DASHSCOPE_API_KEY"] = "..."
from langfuse.openai import OpenAI

client = OpenAI(
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
    api_key=os.environ["DASHSCOPE_API_KEY"],
)

response = client.chat.completions.create(
    model="qwen-plus",
    messages=[{"role": "user", "content": "你好"}],
)
print(response.choices[0].message.content)

See also

On this page