admin管理员组文章数量:1026989
自己搭建的网站,目前没任何限制,使用php调用官方接口。代码在下方分享给大家。chatGPT中文站
```php
// Set up the cURL request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.openai/v1/completions");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
"model": "text-davinci-003",
"prompt": "'.$text.'",
"max_tokens": 2048
}');
curl_setopt($ch, CURLOPT_POST, 1);
// Set the API key as an HTTP header
$headers = array();
$headers[] = "Content-Type: application/json";
$headers[] = "Authorization: Bearer 你的KEY";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// Send the request and parse the response
$response = curl_exec($ch);
$response_data = json_decode($response, true);
if (curl_errno($ch)) {
// If there was an error executing the
自己搭建的网站,目前没任何限制,使用php调用官方接口。代码在下方分享给大家。chatGPT中文站
```php
// Set up the cURL request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.openai/v1/completions");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
"model": "text-davinci-003",
"prompt": "'.$text.'",
"max_tokens": 2048
}');
curl_setopt($ch, CURLOPT_POST, 1);
// Set the API key as an HTTP header
$headers = array();
$headers[] = "Content-Type: application/json";
$headers[] = "Authorization: Bearer 你的KEY";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// Send the request and parse the response
$response = curl_exec($ch);
$response_data = json_decode($response, true);
if (curl_errno($ch)) {
// If there was an error executing the
版权声明:本文标题:chatGPT中文站 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1717336099a449385.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论