How to Integrate Claude Code into Alibaba Cloud DSW for AI-Powered Programming Assistance
Learn how to install and configure Claude Code, a command-line AI programming assistant, in Alibaba Cloud's Data Science Workshop (DSW) to leverage...
Claude Code, a command-line AI programming assistant, has become a go-to tool for developers looking to streamline code writing, debugging, and project refactoring. For users of Alibaba Cloud’s Data Science Workshop (DSW), integrating Claude Code is straightforward—offering access to a range of powerful large language models (LLMs) via the PAI-Token service, with benefits like low-latency internal network access and unified billing.
To get started, open the DSW Terminal and run the installation script: curl -fsSL https://pai-dsw-ai-machine.oss-cn-beijing.aliyuncs.com/agent/claude/setup-cc-dsw.sh -o setup-cc-dsw.sh && bash setup-cc-dsw.sh. This script automates the installation of Node.js and Claude Code, guides you through model service configuration, and persists settings to /mnt/workspace (or a user-specified path) so you don’t have to reinstall after restarting your DSW instance.
The recommended model service for Claude Code in DSW is PAI-Token, which eliminates the need for manual vLLM deployment. It supports a diverse set of models including Qwen’s latest offerings, DeepSeek, and GLM—all switchable with a single click. Additionally, PAI-Token leverages DSW’s internal network for stable, low-latency calls and integrates with PAI resource billing, making it ideal for enterprise clients. To enable PAI-Token, visit the PAI-Token service console and click "One-Click Enable"; the installation script will then auto-configure the token if your DSW instance has the default PAI role (ALIBABA_CLOUD_CREDENTIALS_URI available).
Choosing the right model depends on your task: For general programming or refactoring, qwen3.7-max (the flagship model) is recommended. Code-specific tasks like long-context generation benefit from qwen3-coder-plus, while complex reasoning or architecture-level refactoring works best with deepseek-v4-pro. Multi-modal tasks (e.g., image understanding) use qwen3-vl-plus, and quick QA or simple edits can opt for the lightweight deepseek-v4-flash. Cost-effective options include qwen3.6-plus or qwen3.5-plus, and GLM series models (glm-5.2, glm-5.1, glm-5) are also available. To switch models later, edit the ANTHROPIC_MODEL field in ~/.claude/settings.json or re-run the script with the --reconfigure flag.
Once set up, navigate to your project directory and run claude to start the assistant. For example, you can ask it to refactor a Jupyter Notebook into a training script with support for config parameters, multi-card training, and checkpoint saving. Claude Code will read the notebook, understand its logic, and generate the script—all verifiable directly in the Terminal. Other use cases include debugging CUDA OOM errors (with batch size adjustment suggestions), generating data processing scripts, creating DLC distributed training configurations, and debugging EAS inference services without deploying to production.
To enhance Claude Code’s understanding of your project, use CLAUDE.md files. These files store information that can’t be inferred from code, such as GPU models/quantities, Python/CUDA versions, key file paths, common commands, and prohibitions (e.g., "Do not write to /home" or "Avoid direct commits to main"). The installation script generates global (~/.claude/CLAUDE.md) and project-level (project root) versions, and you can add local versions in subdirectories. If Claude Code repeats an error, input a rule starting with # in the conversation, and it will auto-add it to CLAUDE.md.
Useful tips for optimal use: Always start Claude Code in your project directory (e.g., /mnt/workspace/your-project) to ensure it correctly perceives project files. Use the /compact command to clear historical dialogue and free up context space for new tasks. Initialize a Git repository before using Claude Code to easily roll back changes. For data persistence, mount NAS or CPFS to /mnt/workspace—these storage options retain data even after deleting DSW instances, unlike cloud disks which may clear data after 15 days of inactivity (for public resource groups) or instance deletion (for dedicated resource groups).
Sources
- Alibaba Cloud PAI Help Center: DSW Use Cases