news 2026/4/23 16:26:15

Deepseek模型在线API调用

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
Deepseek模型在线API调用

首先我们需要去deepseek官网去注册deepseek:https://platform.deepseek.com/sign_in

然后我们要创建APIKEY,并配置到系统的环境变量中去。

DeepSeek API使用与OpenAI兼容的API格式,我们需要在OpenAIAPI调用格式的基础上,将OpenAIbase_url替换为DeepSeekendpoint,以及将model替换为DeepSeekmodel。其中DeepSeek v3model名称是:deepseek-chat

# Please install OpenAI SDK first: `pip3 install openai` import os from openai import OpenAI client = OpenAI( api_key="sk-cf464a9877474ee087fcf20a373bdc66", base_url="https://api.deepseek.com") response = client.chat.completions.create( model="deepseek-chat", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": "Hello"}, ], stream=False ) print(response.choices[0].message.content)

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/23 8:15:42

如何突破Masa模组语言壁垒?技术玩家必备的中文适配方案

如何突破Masa模组语言壁垒?技术玩家必备的中文适配方案 【免费下载链接】masa-mods-chinese 一个masa mods的汉化资源包 项目地址: https://gitcode.com/gh_mirrors/ma/masa-mods-chinese 直面Minecraft技术模组的本地化痛点 对于国内Minecraft技术玩家而言…

作者头像 李华
网站建设 2026/4/23 8:19:37

3D视频转2D工具:无需VR设备也能观看3D内容的开源解决方案

3D视频转2D工具:无需VR设备也能观看3D内容的开源解决方案 【免费下载链接】VR-reversal VR-Reversal - Player for conversion of 3D video to 2D with optional saving of head tracking data and rendering out of 2D copies. 项目地址: https://gitcode.com/gh…

作者头像 李华
网站建设 2026/4/23 8:16:46

突破性脑机接口技术:MetaBCI全栈解决方案深度探索

突破性脑机接口技术:MetaBCI全栈解决方案深度探索 【免费下载链接】MetaBCI MetaBCI: China’s first open-source platform for non-invasive brain computer interface. The project of MetaBCI is led by Prof. Minpeng Xu from Tianjin University, China. 项…

作者头像 李华
网站建设 2026/4/23 9:58:36

AI麻将辅助工具Akagi使用指南:提升雀魂水平的技术方案

AI麻将辅助工具Akagi使用指南:提升雀魂水平的技术方案 【免费下载链接】Akagi A helper client for Majsoul 项目地址: https://gitcode.com/gh_mirrors/ak/Akagi Akagi作为一款开源的AI麻将分析工具,专为雀魂游戏玩家设计,通过实时对…

作者头像 李华
网站建设 2026/4/23 9:57:22

安全调查全栈工具:数字取证实战指南

安全调查全栈工具:数字取证实战指南 【免费下载链接】awesome-forensics A curated list of awesome forensic analysis tools and resources 项目地址: https://gitcode.com/gh_mirrors/aw/awesome-forensics 解锁威胁狩猎新范式 🛡️ 你是否曾…

作者头像 李华
网站建设 2026/4/23 9:17:30

Emotion2Vec+ Large适合短语音分析,推荐3-10秒最佳时长

Emotion2Vec Large语音情感识别系统:为什么3-10秒短语音才是它的黄金时长? 在语音情感分析的实际应用中,我们常常陷入一个误区:认为“越长的音频越能反映真实情感”。但当你真正用过Emotion2Vec Large这个模型,就会发…

作者头像 李华