MaaS-DS
介绍
DeepSeek 模型是北京深度求索人工智能基础技术研究有限公司推出的深度合成服务算法。
-
DeepSeek R1(cloudsway 官网名称为:MaaS-DS-R1)
-
特点:模型包含包含 671B 参数,激活 37B,采用了大规模强化学习技术,仅需少量标注数据即可显著提升模型性能,降低了对大量标注数据的依赖,提高了训练效率。在数学、代码和推理任务上表现出色,与 OpenAI 的模型相比毫不逊色,且在成本控制上表现尤为突出,通过优化算法和训练流程,大幅降低了训练和推理的成本。
-
DeepSeek V3(cloudsway 官网名称为:MaaS-DS-V3)
-
特点:为 MoE 模型,模型包含包含 671B 参数,激活 37B。应用场景广泛,涵盖聊天和编码场景、多语言自动翻译、图像生成和 AI 绘画等。
快速开始
1、您登录控制台,创建 AK。AK 是作为调用模型的凭证请妥善保存。
2、访问 MaaS API 创建模型,获取模型的 endpoint (部分模型不支持控制台自助创建,由后台创建为您提供对应的 endpoint)
3、完成调用
您可以通过以下方式快速体验 MaaS-DS 模型。
示例代码
Python 示例
python
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="YOUR_ENDPOINT")
messages = [{"role": "user", "content": "9.11 and 9.8, which is greater?"}]
response = client.chat.completions.create(
model="deepseek-r1",
messages=messages
)
reasoning_content = response.choices[0].message.reasoning_content
content = response.choices[0].message.content
HTTP 示例
curl --location 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/chat/completions' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"model": "deepseek-r1",
"messages": [
{
"role": "user",
"content": "hi"
}
],
"stream": false
}'
流式输出
MaaS-DS-R1 模型可能会输出较长的思考过程,为了降低超时风险,建议您使用流式输出方式来调用。
示例代码
Python 示例
python
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="YOUR_ENDPOINT")
messages = [{"role": "user", "content": "9.11 and 9.8, which is greater?"}]
response = client.chat.completions.create(
model="deepseek-reasoner",
messages=messages,
stream=true
)
reasoning_content = ""
content = ""
for chunk in response:
if chunk.choices[0].delta.reasoning_content:
reasoning_content += chunk.choices[0].delta.reasoning_content
else:
content += chunk.choices[0].delta.content
HTTP 示例
curl --location 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/chat/completions' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"model": "deepseek-r1",
"messages": [
{
"role": "user",
"content": "hi"
}
],
"stream": true
}'
参数支持
MaaS-DS 模型遵循 OpenAI API 标准协议
MaaS-DS-R1 模型
-
上下文长度:API 最大支持 64K 上下文,输出的 reasoning_content 长度不计入 64K 上下文长度中
-
不支持的功能:Function Call、Json Output、FIM 补全 (Beta)
-
不支持的参数:temperature、top_p、presence_penalty、frequency_penalty、logprobs、top_logprobs。请注意,为了兼容已有软件,设置 temperature、top_p、presence_penalty、frequency_penalty 参数不会报错,但也不会生效。设置 logprobs、top_logprobs 会报错。
MaaS-DS-V3 模型
-
上下文长度:API 最大支持 64K 上下文,输出的 reasoning_content 长度不计入 64K 上下文长度中
-
不支持的功能:Function Call、Json Output
-
不支持的参数:frequency_penalty、logprobs、top_logprobs。
常见问题
1、 MaaS-DS-R1 模型 辑推理时间,有时候思考过程长,如何优化
您可以打开 stream 模式,提高首字响应速度速度,降低一次性获取整个响应的时间。参考上文示例中:stream=true
2、 reasoning_content 如何获取
非流式
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="YOUR_ENDPOINT")
# Round 1
messages = [{"role": "user", "content": "9.11 and 9.8, which is greater?"}]
response = client.chat.completions.create(
model="deepseek-r1",
messages=messages
)
reasoning_content = response.choices[0].message.reasoning_content
content = response.choices[0].message.content
流式
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="YOUR_ENDPOINT")
# Round 1
messages = [{"role": "user", "content": "9.11 and 9.8, which is greater?"}]
response = client.chat.completions.create(
model="deepseek-reasoner",
messages=messages,
stream=true
)
reasoning_content = ""
content = ""
for chunk in response:
if chunk.choices[0].delta.reasoning_content:
reasoning_content += chunk.choices[0].delta.reasoning_content
else:
content += chunk.choices[0].delta.content
3、如何接入Dify
i、 在模型供应商处,选择OpenAI-API-compatible,选择添加模型
ii、 模型配置中,
模型名称:写cloudsway官方给出的模型全称;
API Key: 填写cloudsway控制台获取到的AK (不需要SK);
API endpoint URL : https://genaiapi.cloudsway.net/v1/ai/{endpoint}
iii、配置完在这里就能看到您的模型,配置成功
4、如何接入chatbox
i. 在设置界面可以自定义模型供应商用来标记
ii. 模型配置中,
名称:可自定义用于识别
API Host:固定为:https://genaiapi.cloudsway.net/v1
API Path:/ai/{endpoint}/chat/completions
Improve Network Compatibility(改善网络兼容性):建议开启
API Key : 从控制台获取的AK
Model:cloudsway官方给出的模型名称,比如MaaS-DS-R1
iii、配置完保存可以对话测试