啊啊啊啊啊

复制代码
import requests
import json

url = "https://api.deepseek.com/chat/completions"

payload = json.dumps({
  "messages": [
    {
      "content": "你是一个父亲",
      "role": "system"
    },
    {
      "content": "你好",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "thinking": {
    "type": "disabled"
  },
  "reasoning_effort": "none",
  "max_tokens": 4096,
  "response_format": {
    "type": "text"
  },
  "stop": None,
  "stream": False,
  "stream_options": None,
  "temperature": 1,
  "top_p": 1,
  "tools": None,
  "tool_choice": "none",
  "logprobs": False,
  "top_logprobs": None
})
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer sk-773b19c1d2aa46e788e6ae411d99f007'
}

response = requests.request("POST", url, headers=headers, data=payload)

===================

OkHttpClient client = new OkHttpClient().newBuilder()

.build();

MediaType mediaType = MediaType.parse("application/json");

RequestBody body = RequestBody.create(mediaType, "{\n \"messages\": \\n {\\n \\"content\\": \\"You are a helpful assistant\\",\\n \\"role\\": \\"system\\"\\n },\\n {\\n \\"content\\": \\"Hi\\",\\n \\"role\\": \\"user\\"\\n }\\n ,\n \"model\": \"deepseek-flash\",\n \"thinking\": {\n \"type\": \"enabled\"\n },\n \"reasoning_effort\": \"none\",\n \"max_tokens\": 4096,\n \"response_format\": {\n \"type\": \"text\"\n },\n \"stop\": null,\n \"stream\": false,\n \"stream_options\": null,\n \"temperature\": 1,\n \"top_p\": 1,\n \"tools\": null,\n \"tool_choice\": \"none\",\n \"logprobs\": false,\n \"top_logprobs\": null\n}");

Request request = new Request.Builder()

.url("https://api.deepseek.com/chat/completions")

.method("POST", body)

.addHeader("Content-Type", "application/json")

.addHeader("Accept", "application/json")

.addHeader("Authorization", "Bearer <TOKEN>")

.build();

Response response = client.newCall(request).execute();

相关推荐
2301_801184754 小时前
linux系统注意知识
linux·运维·服务器
程序猿追6 小时前
换场倒计时的暂停、重置与到点回调在 HarmonyOS 7 上怎么处理
运维·服务器·数据库·harmonyos
我要见SA姐17 小时前
用生活化类比当钥匙,一键打开 C++ 入门大门
java·开发语言·c++
@forever@7 小时前
【MySQL】数据库基础、架构与存储引擎详解
数据库·mysql·架构
LaughingZhu8 小时前
Product Hunt 热榜 2026-12-05:SoduWork、finerd split、Otari by Mozilla AI
java·人工智能·docker·chatgpt·容器
轩轩曲觞阁8 小时前
MySQL基础——数据类型
数据库·mysql
jnrjian8 小时前
Oracle 19C LogMiner 分析 Supplemental Log Groups
数据库·oracle
L-影9 小时前
HashMap详解-上篇
java·开发语言·spring·hashmap
爱笑的源码基地9 小时前
什么是智能预问诊系统?一套java版预问诊成品源码
java·源码·程序·预问诊·智能问诊·预问诊源码
她说..9 小时前
幂等问题分析
java·jvm·spring boot·spring·spring cloud·intellij-idea