5118助手
| 名称 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| retype | int | 否 | 0 | retype=1:模型3号(默认选中);retype=2:模型2号;retype=3:模型1号; |
| txt | string | 是 | 全文内容(长度不能超过5000字符(含html字符),如有html字符,需要使用UrlEncode进行编码) | |
| keephtml | string | 否 | true | 是否保留html格式(默认true:保留,false:去除html格式) |
| sim | int | 否 | 0 | 是否返回相似度(默认0不开启,1为开启) |
| strict | int | 否 | 0 | 严选换词(可以选择不同档位进行严选换词,档位越高换词越严格,默认为0:关闭状态) |
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| errcode | string | 0 | 返回的错误代码 |
| errmsg | string | 返回的错误说明 | |
| like | string | 相似度 | |
| data | string | 伪原创内容 |
{
"errcode": "0",
"errmsg": "",
"like": "0.5521350546176762",
"data": "在线智能工具是网络编辑、员工和站长非常必要的工具。"
}
| 错误码 | 说明 |
|---|---|
| 100101 | 调用次数不够,请充值 |
| 100102 | 服务每秒调用量超限 |
| 100103 | 服务每小时调用量超限 |
| 100104 | 服务每天调用量超限 |
| 100111 | 调用字数不够,请充值 |
| 100201 | url无法解析 |
| 100202 | 请求缺少apikey |
| 100203 | 无效的apikey |
| 100204 | api不存在 |
| 100205 | api已经关闭 |
| 100206 | 后端服务响应status非200 |
| 100207 | 后端服务未正确接入 |
| 100208 | 请求方式不支持 |
| 100301 | Api商城 内部错误 |
| 100302 | 请求后端服务过程中错误 |
| 100303 | 系统繁忙稍候再试 |
| 100403 | 您输入的apikey不正确 |
| 错误码 | 说明 |
|---|---|
| 200107 | 服务器超时 |
| 200201 | 传进参数为空 |
| 200500 | 内容长度不能超过5000个字符 |
| 2005050 | 您输入的内容超过指定长度,不含html标签限5000字符,含html标签限10000字符 |
| 2 | 002 | 01 |
|---|---|---|
| 服务器错误(1:为系统级别错误) | 服务模块代码(即数据ID) | 具体错误代码 |
| 名称 | 价格 | 次数 | 说明 |
|---|---|---|---|
| 首次试用套餐 | 0.00 | 100 | |
| 套餐一 | 500.00 | 15000 | |
| 套餐二 | 3000.00 | 150000 | |
| 套餐三 | 15000.00 | 1500000 | |
| 套餐四 | 51750.00 | 7500000 |
<?php$host = "http://apis.5118.com";$path = "/wyc/rewrite";$method = "POST";$apikey = "你要调用API的apikey";$headers = array();array_push($headers, "Authorization:" . $apikey);//根据API的要求,定义相对应的Content-Typearray_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");$querys = "";$bodys = "keephtml=true&sim=1&retype=3&txt=你要改写的文本";$url = $host . $path;$curl = curl_init();curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);curl_setopt($curl, CURLOPT_FAILONERROR, false);if (1 == strpos("$".$host, "https://")){curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);}curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);curl_exec($curl);?>
#-*- coding:utf-8 -*-import requestsfrom urllib.parse import quoteurl = 'https://apis.5118.com/wyc/rewrite'payload= { 'txt':quote('要改写的文本'), #全文内容(长度不能超过5000字符(含html字符),如含有html字符,使用quote进行编码) 'retype':1, #retype=1:模型3号(默认选中);retype=2:模型2号;retype=3:模型1号 'keephtml':True, #是否保留html格式(默认true:保留,false:去除html格式) 'sim':1 #是否返回相似度(默认0不开启,1为开启)}headers = { 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': '你要调用API的apikey,到 https://account.5118.com/signin/myapi 获取'}response = requests.request("POST", url, headers=headers, data=payload)print(response.json())
using System.IO;using System.Text;using System.Net;using System.Net.Security;using System.Security.Cryptography.X509Certificates;private const String host = "http://apis.5118.com";private const String path = "/wyc/rewrite";private const String method = "POST";private const String apikey = "你要调用的接口apikey";static void Main(string[] args){String querys = "";String bodys = "txt=txt";String url = host + path;HttpWebRequest httpRequest = null;HttpWebResponse httpResponse = null;if (0 < querys.Length){url = url + "?" + querys;}if (host.Contains("https://")){ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));}else{httpRequest = (HttpWebRequest)WebRequest.Create(url);}httpRequest.Method = method;httpRequest.Headers.Add("Authorization", apikey);//根据API的要求,定义相对应的Content-TypehttpRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";if (0 < bodys.Length){byte[] data = Encoding.UTF8.GetBytes(bodys);using (Stream stream = httpRequest.GetRequestStream()){stream.Write(data, 0, data.Length);}}try{httpResponse = (HttpWebResponse)httpRequest.GetResponse();}catch (WebException ex){httpResponse = (HttpWebResponse)ex.Response;}Console.WriteLine(httpResponse.StatusCode);Console.WriteLine(httpResponse.Method);Console.WriteLine(httpResponse.Headers);Stream st = httpResponse.GetResponseStream();StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));Console.WriteLine(reader.ReadToEnd());Console.WriteLine("\n");}public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors){return true;}