接口参考
语法核查
会员内测
POST https://paperpurr.com/v1/check
检查英文文本的语法、拼写、标点和精简,可以自动采纳高把握的更正。引语、引用、链接、代码和参考文献表不会改动。
请求参数
textstring · 必填- 英文文本,最多 10000 词
auto_applyboolean · 默认 truefalse时只列建议,text原样返回levelstring · 默认 allall:语法、拼写、精简和缩写;correctness:只管语法和拼写。dialectstring · 默认 usus或uk
请求示例
curl
curl -X POST "https://paperpurr.com/v1/check" \
-H "Authorization: Bearer $PAPERPURR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"The results shows that the workshop helped. In order to test this, we has run a second survey.","auto_apply":true}'Python
import os
import requests
r = requests.post(
"https://paperpurr.com/v1/check",
headers={"Authorization": f"Bearer {os.environ['PAPERPURR_API_KEY']}"},
json={
"text": "The results shows that the workshop helped. In order to test this, we has run a second survey.",
"auto_apply": true
},
)
print(r.json())JS
const r = await fetch("https://paperpurr.com/v1/check", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PAPERPURR_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"text": "The results shows that the workshop helped. In order to test this, we has run a second survey.",
"auto_apply": true
}),
});
console.log(await r.json());响应
{
"text": "The results show that the workshop helped. To test this, we have run a second survey.",
"corrections": [
{
"before": "has",
"after": "have",
"category": "correctness",
"rule": "Agreement",
"message": "The form of the verb must agree in grammatical number with the pronoun.",
"sentence": "In order to test this, we has run a second survey."
},
{
"before": "In order to",
"after": "To",
"category": "clarity",
"rule": "wordy-phrase",
"message": "This phrase can be said in fewer words.",
"sentence": "In order to test this, we have run a second survey."
},
{
"before": "shows",
"after": "show",
"category": "correctness",
"rule": "subject-verb",
"message": "The subject and the verb don’t agree in number.",
"sentence": "The results shows that the workshop helped."
}
],
"suggestions": [],
"suggestions_total": 0,
"words": 18,
"request_id": "req_3b7e05c2f8a14d96b0e3c5a7"
}textstring · 必填- 更正后的文本
correctionsobject[] · 必填- 已采纳的更正,字段同自然改写
suggestionsobject[] · 必填- 没有自动采纳的建议,最多 40 条
textstring · 必填- 有问题的片段
replacementsstring[] · 必填- 可替换成什么;空字符串表示删掉
sentencestring- 所在的句子
categorystring · 必填- 类别,如
correctness、clarity rulestring · 必填- 规则名
messagestring · 必填- 原因,英文
suggestions_totalinteger · 必填- 建议总数,可能多于返回的条数
wordsinteger · 必填- 提交的词数
request_idstring · 必填- 请求 ID
可能的错误
| 状态码 | code | 原因 | 怎么处理 |
|---|---|---|---|
400 | missing_parameter | 缺少必填参数,param 指出是哪个 | 补上这个参数 |
400 | invalid_parameter | 参数格式或取值不对,param 指出是哪个 | 按接口文档的类型和范围改 |
400 | unknown_parameter | 传了接口不认识的参数(查询参数或请求体字段) | 删掉它,或检查拼写 |
400 | invalid_json | 请求体不是 JSON 对象 | 用 Content-Type: application/json 发送一个对象 |
413 | too_long | text 超过单次词数上限 | 按小节拆开,分几次调用 |
413 | body_too_large | 请求体太大:REST 最多 128 KB,MCP 最多 256 KB | 减少条数或缩短内容 |
429 | rate_limit_exceeded | 撞上了某一层限流,message 说明原因 | 等 Retry-After 秒再重试;多个进程共用一把密钥时把请求排队 |
429 503 | busy | 429:改写或核查排队的人太多。503:额度或用量暂时读写不了,没有处理也没有计量 | 有 Retry-After 就按它等,没有就退避后重试 |
502 | upstream_unavailable | 文献数据库、改写模型或核查服务没有响应 | 稍后重试,这次不计量 |
计量
- 内测期免费,计入请求频率限制。
- 核查的文本不保存。