Skip to main content

Model Providers

Alibaba Qwen

Serve Qwen models from Alibaba Model Studio through your Verdictan gateway. The gateway calls the OpenAI-compatible mode of Model Studio with your Alibaba key, and your application calls the gateway with its Verdictan application token.

This page connects Qwen as a model provider. To route the Qwen Code command-line tool through Verdictan, see Qwen Code CLI.

Before you start​

  • A working gateway from the quickstart.
  • An Alibaba Model Studio API key, and one Qwen model ID that your account can use.
  • The gateway startup command, and a separate application token for test requests.

Configure the provider​

Use provider: qwen or provider: alibaba. Avoid the dashscope alias: it works for chat, but the gateway does not route embeddings for it.

policy-config.yaml
pack:
  name: qwen-integration
  version: 1.0.0
  enabled: true
policies:
  chain:
    - prompt-injection
providers:
  targets:
    - id: qwen-primary
      provider: qwen
      model: "replace-with-qwen-model-id"
      base_url: https://dashscope-intl.aliyuncs.com/compatible-mode
      secret_key_ref:
        env: VERDICTAN_QWEN_API_KEY

The example uses the international compatible-mode address, which is also the default. If your account belongs to another region, set base_url to that region's address, which must start with https://. The gateway sends the key from VERDICTAN_QWEN_API_KEY as a Bearer token.

Start and verify​

You can use CLI 0.1.14 or later for the Qwen configuration deployment. After In sync, send the request below to verify the selected model and provider key.

With the quickstart in Docker, follow the container steps instead of steps 1 to 3.

  1. In the gateway terminal, set the key and lint the file:

    export VERDICTAN_QWEN_API_KEY="<provider-api-key>"
    verdictan policy lint --file policy-config.yaml
  2. Restart the test gateway with the key in its environment.

  3. Deploy the file to the test agent in Configurations. If that agent already runs pack.version 1.0.0, increase the version first. Then wait for the gateway log line connected read model refresh applied updated config with your version as config_version. Try the change on a test gateway has the steps.

  4. In a second terminal, send a request for the configured model:

    export VERDICTAN_CLIENT_TOKEN="<application-token>"
    curl --fail-with-body http://127.0.0.1:41002/v1/chat/completions \
      -H "Authorization: Bearer ${VERDICTAN_CLIENT_TOKEN}" \
      -H "Content-Type: application/json" \
      -d '{"model":"replace-with-qwen-model-id","messages":[{"role":"user","content":"Reply with Hello."}]}'

choices[0].message.content contains the reply, and the request appears in History when capture is on, or in the delivered events.

Supported requests​

RequestSupport
Chat CompletionsYes, including streaming and tool calls
MessagesTranslated to Chat Completions
EmbeddingsYes, with provider: qwen or alibaba, and an embedding model. The policy chain does not run on embeddings.
Responses, image input, response_format, parallel tool callsNo

Failure behavior​

ProblemWhat to check
401 from the gatewayThe application token is active, and the key is set on the gateway host.
Provider authentication errorVERDICTAN_QWEN_API_KEY is set in the gateway process, and it belongs to the region of base_url.
Model not foundThe request model matches the target, and your account can use it.
capability.unsupported_familyThe request uses a family from the table above, and the alias is not dashscope for embeddings.
Provider 429 or another upstream errorThe response body and your Model Studio quota. See Error Handling.

Limits​

  • Model names, regional addresses, prices, rate limits, and data terms are in the Alibaba Model Studio documentation. Verdictan does not publish them.
  • Streaming and tools vary by Qwen model. Test each one with your model.
  • A listener on a non-loopback address needs TLS and network controls.

Next steps​