生成内容接口
<h5>简要描述</h5>
<ul>
<li>这是AI生成内容接口协议说明。如果你想看接口生成的内容都支持哪些功能,以及想测试接口的耗时,都可以访问 <a href="https://www.aiznx.com">https://www.aiznx.com</a> 。我们直接提供国内域名服务器的接口,访问超快。你可以试用下官网功能,它也是和开放api共用同一套服务。</li>
</ul>
<h5>请求URL</h5>
<ul>
<li>
<p><code>https://www.aiznx.com/server/open/send</code></p>
<p>如果部分特殊网络环境下、https证书校验有问题,则可通过http协议调用,即 <a href="http://www.aiznx.com/server/open/send">http://www.aiznx.com/server/open/send</a></p>
</li>
</ul>
<h5>请求方式</h5>
<ul>
<li>POST </li>
</ul>
<h4>Header</h4>
<p><code>Content-Type : application/x-www-form-urlencoded</code></p>
<h5>参数</h5>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">必选</th>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">api_key</td>
<td style="text-align: left;">是</td>
<td style="text-align: left;">string</td>
<td>认证用的api_key。 登录https://www.aiznx.com/dashboard/ 即可看到</td>
</tr>
<tr>
<td style="text-align: left;">type</td>
<td style="text-align: left;">是</td>
<td style="text-align: left;">string</td>
<td>类型 ,比如说是周报生成器还是小红书风格生成器。由于工具类型众多,所以将单独写一页介绍。请翻阅文档左侧菜单,查看类型和功能的对应关系表</td>
</tr>
<tr>
<td style="text-align: left;">content</td>
<td style="text-align: left;">是</td>
<td style="text-align: left;">string</td>
<td>内容。一般是用户的输入</td>
</tr>
<tr>
<td style="text-align: left;">stream</td>
<td style="text-align: left;">否</td>
<td style="text-align: left;">int</td>
<td>接口是否以stream流的方式返回,以便前端实现逐字打字机效果。默认值是0。0的时候会响应普通的json结果(会相对慢一些)。传 1 的时候表示stream的方式返回一串流(显示文案更快,但需要多做一点开发工作,你要自行解析stream流,参考文后的例子)</td>
</tr>
</tbody>
</table>
<h5>成功示例 (当 stream = 0 时 )</h5>
<pre><code> {
&quot;error_code&quot;: 0,
&quot;data&quot;: {
&quot;content&quot;: &quot;这里是结果内容&quot;
}
}
</code></pre>
<h5>失败示例 (当 stream = 0 时 )</h5>
<pre><code>
{
&quot;error_code&quot;:10301
&quot;error_message&quot;:&quot;api_key不正确&quot;
}
// 或者
{
&quot;error_code&quot;:10302
&quot;error_message&quot;:&quot;你的账号余额不足,请到网页上充值&quot;
}</code></pre>
<h5>返回参数说明 (当 stream = 0 时 )</h5>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">error_code</td>
<td style="text-align: left;">int</td>
<td>错误码。当为0 的时候,表示没有发生错误,即接口请求成功。当非0的时候表示有错误</td>
</tr>
</tbody>
</table>
<h5>成功示例 (当 stream = 1 时 )</h5>
<pre><code>
// stream = 1的时候以流的形式返回一连串json字符串,你需要按行截断然后解析展示。
// 如果是sream方式调用,你可以参考下这个第三方教程 https://www.wyr.me/post/736 (或者 https://learnku.com/articles/78210 ) 里对返回内容的处理部分。
// 你只需要看前端代码 对返回数据的处理 那部分的逻辑。我们的接口跟chatGPT官方接口的请求参数方式不一样,但stream模式下返回的数据是一样的,对返回内容的处理逻辑可以复用。
// sream方式是通用的,也不是我们平台特有协议,你可以看下人家是怎么处理的。
data: {&quot;id&quot;:&quot;chatcmpl-6zgQCwSFxb1zcRqwIS71MfJnfw5as&quot;,&quot;object&quot;:&quot;chat.completion.chunk&quot;,&quot;created&quot;:1680159096,&quot;model&quot;:&quot;gpt-3.5-turbo-0301&quot;,&quot;choices&quot;:[{&quot;delta&quot;:{&quot;role&quot;:&quot;assistant&quot;},&quot;index&quot;:0,&quot;finish_reason&quot;:null}]}
data: {&quot;id&quot;:&quot;chatcmpl-6zgQCwSFxb1zcRqwIS71MfJnfw5as&quot;,&quot;object&quot;:&quot;chat.completion.chunk&quot;,&quot;created&quot;:1680159096,&quot;model&quot;:&quot;gpt-3.5-turbo-0301&quot;,&quot;choices&quot;:[{&quot;delta&quot;:{&quot;content&quot;:&quot;可以&quot;},&quot;index&quot;:0,&quot;finish_reason&quot;:null}]}
data: {&quot;id&quot;:&quot;chatcmpl-6zgQCwSFxb1zcRqwIS71MfJnfw5as&quot;,&quot;object&quot;:&quot;chat.completion.chunk&quot;,&quot;created&quot;:1680159096,&quot;model&quot;:&quot;gpt-3.5-turbo-0301&quot;,&quot;choices&quot;:[{&quot;delta&quot;:{},&quot;index&quot;:0,&quot;finish_reason&quot;:&quot;stop&quot;}]}
data: [DONE]
</code></pre>