Skip to main content

Overview

For production use without managing infrastructure, you can access Qwen3-VL through the DashScope API service. The API is fully compatible with the OpenAI client library, making integration seamless.

Getting Started

1. Get Your API Key

Obtain your DashScope API key from Aliyun Model Studio.

2. Install OpenAI Client

Using the API

Here’s a complete example of using the DashScope API with the OpenAI client:

API Configuration

Client Setup

When initializing the OpenAI client for DashScope:

Available Models

The following Qwen3-VL models are available through the API:
  • qwen3-vl-235b-a22b-instruct: Large-scale instruction-tuned model
  • Other model variants (check the official documentation for the full list)

Multimodal Input

Image Input

Provide images via URL:

Video Input

Provide videos via URL:

Multiple Images

Include multiple images in a single request:

Response Format

The API returns responses in the standard OpenAI format:

Advanced Parameters

Customize generation with additional parameters:

Streaming Responses

Enable streaming for real-time output:

Error Handling

Implement proper error handling:

Best Practices

API Key Security

  • Never hardcode API keys in your source code
  • Use environment variables:

Rate Limiting

  • Implement exponential backoff for retries
  • Monitor your API usage
  • Cache responses when possible

Cost Optimization

  • Set appropriate max_tokens limits
  • Use batch processing for multiple requests
  • Monitor token usage in responses

Additional Resources

For more detailed information, refer to:

Next Steps