最近deepseek又开放充值了,而且还大降价,果断接入:
1、首先就是去充值,然后获取key
2、打开接口文档-找到合适自己的语言接口
3、直接复制代码就能运行
<?php$curl = curl_init();curl_setopt_array($curl, array(CURLOPT_URL => 'https://api.deepseek.com/chat/completions',CURLOPT_RETURNTRANSFER => true,CURLOPT_ENCODING => '',CURLOPT_MAXREDIRS => 10,CURLOPT_TIMEOUT => 0,CURLOPT_FOLLOWLOCATION => true,CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST => 'POST',CURLOPT_POSTFIELDS =>'{"messages": [{"content": "You are a helpful assistant","role": "system"},{"content": "Hi","role": "user"}],"model": "deepseek-chat","frequency_penalty": 0,"max_tokens": 2048,"presence_penalty": 0,"response_format": {"type": "text"},"stop": null,"stream": false,"stream_options": null,"temperature": 1,"top_p": 1,"tools": null,"tool_choice": "none","logprobs": false,"top_logprobs": null }',CURLOPT_HTTPHEADER => array('Content-Type: application/json','Accept: application/json','Authorization: Bearer <TOKEN>'), ));$response = curl_exec($curl);curl_close($curl); echo $response;
还是比较简单的!