DashScope provider

Related Documentation
Minimum Version
AI Gateway - 2.0
Incompatible with
on-prem
Tags
#ai
Previous Versions of this page

You can proxy requests to DashScope AI models through AI Gateway by creating AI Model Provider and AI Model entities. This reference documents all supported AI capabilities, configuration requirements, and provider-specific details needed for proper integration.

Upstream paths

AI Gateway automatically routes requests to the appropriate DashScope API endpoints. The following table shows the upstream paths used for each capability.

Capability

Path template

Description

Upstream path or API

Generate /chat/completions, /completions, or /responses Text generation for chat completions and responses /compatible-mode/v1/chat/completions
Embeddings /embeddings Vector embeddings from text input /compatible-mode/v1/embeddings
Image /images/generations or /images/edits Image generation and editing /api/v1/services/aigc/multimodal-generation/generation and /api/v1/services/aigc/image2image/image-synthesis

Supported capabilities

The following tables show the AI capabilities supported by the DashScope provider when configuring AI Models.

By default, AI Gateway uses the path templates shown in the tables below (e.g., /chat/completions, /embeddings, etc.). To customize these paths, configure the config.paths field in your AI Model entity. Custom paths take the form {configured_path}/{template_path} — for example, if you set a custom path of /v2, requests to /embeddings would be routed to /v2/embeddings.

Text generation

Support for DashScope text generation capabilities:

Capability

Streaming

Model example

Path template

Min version

generate Supported qwen-plus /chat/completions, /completions, or /responses 2.0

Embeddings

Support for DashScope embeddings generation:

Capability

Model example

Path template

Min version

embeddings text-embedding-v1 /embeddings 2.0

Image

Support for DashScope image generation and editing capabilities:

Capability

Model example

Path template

Min version

image qwen-image-plus /images/generations or /images/edits 2.0

For requests with large payloads, consider increasing config.max_request_body_size on your AI Model entity to three times the raw binary size.

Supported image sizes and formats vary by model. Refer to your provider’s documentation for allowed dimensions and requirements.

DashScope base URL

The base URL is https://dashscope.aliyuncs.com or https://dashscope-intl.aliyuncs.com.

AI Gateway uses this URL automatically. You only need to configure a URL if you’re using a self-hosted or DashScope-compatible endpoint, in which case set the upstream_url option in your AI Model configuration.

Configure DashScope

To use DashScope with AI Gateway, configure a new AI Model Provider. You can then access supported AI Models from DashScope.

Here’s a minimal configuration for chat completions:

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!