This topic describes how to call DeepSeek series models on the Alibaba Cloud Model Studio platform using an OpenAI compatible interface or the DashScope SDK.
Service endpoints
The service endpoint is different for each region. Configure the Base URL based on your selected region (When you call the model, replace {WorkspaceId} with the actual Workspace ID. The available models and rate limits also vary by region. For more information, see the Rate limiting document.
The following DeepSeek models are available in China (Hong Kong): deepseek-v4.1-flash, deepseek-v4.1-flash-1017, deepseek-v4-pro-0813, and deepseek-v4-flash-0731. All four models support the Chat Completions, Responses, and Anthropic Messages APIs in China (Hong Kong).
- OpenAI compatible
- OpenAI compatible - Responses API
- DashScope
- China (Beijing)
- US (Virginia)
- Singapore
- Germany (Frankfurt)
- Japan (Tokyo)
- China (Hong Kong)
The
base_url for SDK call configuration is https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1The HTTP request address is POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completionsGetting started
deepseek-v4-pro-0813 is the flagship model in the DeepSeek series and excels at programming, math, and general tasks. deepseek-v4-flash-0731 is the latest version of the Flash series. You can use the enable_thinking parameter to switch between thinking and non-thinking modes. The following example shows how to call the deepseek-v4-pro model in thinking mode. You can replace the model parameter with other DeepSeek models.
You must obtain an API key and configure it as an environment variable. If you use an SDK, you must also install the OpenAI or DashScope SDK.
- China (Beijing)
- China (Hong Kong)
- OpenAI compatible
- DashScope
- Anthropic compatible
The
enable_thinking parameter is not a standard OpenAI parameter. The OpenAI Python SDK passes it through extra_body, while the Node.js SDK passes it as a top-level parameter. The reasoning_effort parameter is a standard OpenAI parameter and can be passed directly as a top-level parameter.- Python
- Node.js
- HTTP
Sample code
Response
Inference strength (reasoning_effort)
The deepseek-v4.1-flash, deepseek-v4-pro, deepseek-v4-flash-0731, and deepseek-v4-pro-0813 models have thinking mode enabled by default. You can adjust the inference strength using the reasoning_effort parameter. The valid values are low (supported only by deepseek-v4.1-flash, deepseek-v4-flash-0731, and deepseek-v4-pro-0813), high, and max. The default value is high.
- OpenAI compatible
- DashScope
Python
Responses API
deepseek-v4.1-flash, deepseek-v4.1-flash-1017, deepseek-v4-pro, deepseek-v4-pro-0813, and deepseek-v4-flash-0731 all support calls through the OpenAI-compatible Responses API. The models available in each region depend on regional availability. For endpoints, see Service endpoints.
deepseek-v4.1-flash-1017 supports the Responses API in six regions: China (Beijing), Singapore, US (Virginia), Germany (Frankfurt), Japan (Tokyo), and China (Hong Kong). It supports the three built-in tools web_search, web_extractor, and code_interpreter. For the SDK base_url and POST endpoints in all six regions, see Responses API endpoint configuration.
When calling the Responses API, you can add the web_search (Web search), web_extractor (Web extractor), and code_interpreter (Code Interpreter) tools to the tools parameter.
Other features
| Model | Multi-turn conversation | Function Calling | Web search | Context cache | Structured output | Partial mode |
|---|---|---|---|---|---|---|
| deepseek-v4.1-flash-1017 | Supported | Supported | Supported | Supported (implicit caching) | Supported | Not supported |
| deepseek-v4.1-flash | Supported | Supported | Supported | Supported | Supported | Not supported |
| deepseek-v4-pro | Supported | Supported | Supported | Supported | Supported | Not supported |
| deepseek-v4-flash-0731 | Supported | Supported | Supported | Supported | JSON Object supported; JSON Schema not supported | Not supported |
| Distilled models | Supported | Not supported | Not supported | Not supported | Not supported | Not supported |
deepseek-v4.1-flash-1017 supports the OpenAI-compatible Chat Completions API, the Anthropic Messages API, and thinking; it does not support batch calls or fine-tuning.
Default parameter values
Model | temperature | top_p | repetition_penalty | presence_penalty | max_tokens | thinking_budget |
|---|---|---|---|---|---|---|
deepseek-v4.1-flash-1017 | 1.0 | 1.0 | - | - | 393,216 | - |
deepseek-v4.1-flash | 1.0 | 1.0 | - | - | 393,216 | - |
deepseek-v4-pro | 1.0 | 1.0 | - | - | 393,216 in total | |
deepseek-v4-flash-0731 | 1.0 | 1.0 | - | - | 393,216 in total | |
Distilled version | 0.6 | 0.95 | - | 1 | 16,384 | 16,384 |
- A hyphen (-) indicates that the parameter has no default value and cannot be set.
- The distilled models do not support setting these parameter values.
- "393,216 in total" indicates that for deepseek-v4 series models, max_tokens and thinking_budget share the same limit, and their combined maximum is 393,216 tokens (the maximum output length of the model).
- For parameter definitions, see OpenAI compatible - Chat.
Models and billing
- Hybrid thinking models (use the
enable_thinkingparameter to control thinking mode): deepseek-v4.1-flash, deepseek-v4-pro, and deepseek-v4-flash-0731
In thinking mode, the chain-of-thought is billed as output tokens.
FAQ
How do I purchase tokens after my free quota is used up?
You can go to the Expenses and Costs center to top up your account. To call DeepSeek models, ensure that your account has no overdue payments.
Calls to DeepSeek models are automatically charged. The billing cycle is minute-based. To view your consumption details, go to Bill Details.
How do I connect toChatbox,Cherry Studio, orDify?
This section uses common developer tools as examples. The connection method for other LLM tools is similar.
- Chatbox
- Cherry Studio
- Dify
For more information, see Chatbox.
Can I upload images or documents to ask questions?
deepseek-v4.1-flash and deepseek-v4.1-flash-1017 support text and image input and text-only output. For other models, see the corresponding model information page for supported input modalities. For image input, you can also use the Qwen-VL model. For document input, use the Qwen-Long model.
How do I view token usage and the number of calls?
You can view the call results in the monitoring chart at the minute level after a model call occurs. Log in to the Model Monitoring page, select O&M Management > Model Monitoring in the left-side navigation pane to enter the monitoring overview page, and set the query conditions (for example, select the time range and workspace). Then, in the Models area, find the target model and click View Details to view the call statistics for the model. For more information, see the Monitoring & Alerts document.
Monitoring data is updated at the minute level and is for reference only. It is not used as a basis for billing.
What are the other ways to use DeepSeek?
You can use DeepSeek on the Model Studio platform in three ways:
- Online experience: Go to the Model Marketplace.
- API or client calls: Call the model using an API or a client such as Chatbox. For more information, see this topic.
- Zero-code application building: Build LLM applications with zero code. For more information, see Agent application or Workflow application.