All Products
Search
Document Center

Alibaba Cloud Model Studio:Install the SDK

Last Updated:Dec 05, 2025

Alibaba Cloud Model Studio provides the official DashScope SDK for Python and Java. You can also use OpenAI SDKs for Python, Node.js, Java, and Go.

Install the SDK

Python

This SDK requires Python >= 3.8.

You can call models on the Alibaba Cloud Model Studio platform using the OpenAI Python SDK or the DashScope Python SDK.

Install the OpenAI Python SDK

Run the following command to install the OpenAI Python SDK:

# If the command fails to run, you can replace pip with pip3 and run it again.
pip install -U openai

image

When the Successfully installed ... openai-x.x.x message appears in the terminal, the OpenAI Python SDK has been installed.

Install the DashScope Python SDK

Run the following command to install the DashScope Python SDK:

# If the command fails to run, you can replace pip with pip3 and run it again.
pip install -U dashscope

image

When the Successfully installed ... dashscope-x.x.x message appears in the terminal, the DashScope Python SDK has been installed.

Note

If the WARNING: You are using pip version xxx; however, version xxx is available. message appears during the SDK installation, it is a notification to update your pip tool and does not affect the SDK installation. You can ignore this message.

Java

DashScope

In your project, add the DashScope Java SDK dependency. Replace the-latest-version with the latest version number.

Gradle

dependencies {
    implementation group: 'com.alibaba', name: 'dashscope-sdk-java', version: 'the-latest-version'
}

Maven

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>dashscope-sdk-java</artifactId>
    <version>the-latest-version</version>
</dependency>

OpenAI

In your project, add the OpenAI Java SDK dependency. Replace the-latest-version with the latest version number. The recommended version is 3.5.0.

This SDK requires Java 8 or a later version.

Gradle

dependencies {
    implementation("com.openai:openai-java:the-latest-version")
}

Maven

<dependency>
  <groupId>com.openai</groupId>
  <artifactId>openai-java</artifactId>
  <version>the-latest-version</version>
</dependency>

Node.js

OpenAI

Run the following command in the terminal:

npm install --save openai
# or
yarn add openai
Note

If the installation fails, you can configure a traffic mirror source to complete the installation. For example:

npm config set registry https://registry.npmmirror.com/

After you configure the traffic mirror source, run the SDK installation command again.

image

When the added xx package in xxs message appears in the terminal, the OpenAI SDK has been installed. You can use npm list openai to check the specific version information.

Go

OpenAI

OpenAI provides an SDK for the Go language that requires Go 1.22+. To install it, run the following command in your project folder:

go get 'github.com/openai/openai-go/v3'

Alternatively, you can install a specific version:

go get -u 'github.com/openai/openai-go/v2@v3.8.1'
If access to the server times out, you can set an Alibaba Cloud mirror proxy: go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct

Use the following command to import the SDK into your code:

import (
	"github.com/openai/openai-go/v3" // imported as openai
)

What to do next

After you install the SDK: