Administrator
Administrator
发布于 2025-10-30 / 1 阅读
0
0

TonaAi-OpenAPI接口文档

TonaAi-OpenAPI接口文档

Base URLs: https://openapi.tonaai.cn

openapi/v1/file

POST 上传文件

POST /v1/file/upload

Body 请求参数

file: file://C:\Users\tansor\Desktop\test.docx

请求参数

名称位置类型必选说明
ApiKeyheaderstring在控制台的个人主页获取
bodybodyobjectnone
» filebodystring(binary)none

返回示例

200 Response

{
  "fileId": 0,
  "wordNum": 0
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» fileIdnumbertruenone文件ID
» wordNumnumbertruenone字数

openapi/v1/task

POST AIGC检测

POST /v1/task/aigc_check

app_id:默认写1001
时间戳字符串生成示例:String timestamp = java.time.ZonedDateTime.now().toString();系统允许三分钟以内的时间误差
随机字符串生成示例:String nonceStr = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 16);

Body 请求参数

{
  "app_id": "string",
  "timestamp": "string",
  "nonce_str": "string",
  "data": {
    "title": "string",
    "author": "string",
    "fileId": 0
  }
}

请求参数

名称位置类型必选说明
ApiKeyheaderstring在控制台的个人主页获取
bodybodyobjectnone
» app_idbodystring默认1001
» timestampbodystring时间戳
» nonce_strbodystring随机字符串
» databodyobjectnone
»» titlebodystring文章标题
»» authorbodystring文章作者
»» fileIdbodynumber文件ID

返回示例

200 Response

{
  "code": 0,
  "message": "string",
  "data": {
    "taskId": "string"
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenone0-成功,1-失败
» messagestringtruenone请求失败时此处可能会有消息提示
» dataobjecttruenonenone
»» taskIdstringtruenone任务id

POST 降AI率

POST /v1/task/reduce_ai_rate

app_id:默认写1001
时间戳字符串生成示例:String timestamp = java.time.ZonedDateTime.now().toString();系统允许三分钟以内的时间误差
随机字符串生成示例:String nonceStr = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 16);

Body 请求参数

{
  "app_id": "string",
  "timestamp": "string",
  "nonce_str": "string",
  "data": {
    "origin": "string",
    "type": "string",
    "lang": "string",
    "mode": "string"
  }
}

请求参数

名称位置类型必选说明
ApiKeyheaderstring在控制台的个人主页获取
bodybodyobjectnone
» app_idbodystring默认1001
» timestampbodystring时间戳
» nonce_strbodystring随机字符串
» databodyobjectnone
»» originbodystring文本内容或者文件ID
»» typebodystringtext-文本,file-文件
»» langbodystringcn-中文,en-英文
»» modebodystringnormal-普通,powerful-强力

返回示例

200 Response

{
  "code": 0,
  "message": "string",
  "data": {
    "taskId": "string",
    "cost": 0
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenone0-成功,1-失败
» messagestringtruenone请求失败时此处可能会有消息提示
» dataobjecttruenonenone
»» taskIdstringtruenone任务id
»» costnumbertruenone此任务的消费金额

POST 降重复率

POST /v1/task/reduce_rp_rate

app_id:默认写1001
时间戳字符串生成示例:String timestamp = java.time.ZonedDateTime.now().toString();系统允许三分钟以内的时间误差
随机字符串生成示例:String nonceStr = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 16);

Body 请求参数

{
  "app_id": "string",
  "timestamp": "string",
  "nonce_str": "string",
  "data": {
    "origin": "string",
    "type": "string",
    "lang": "string",
    "mode": "string"
  }
}

请求参数

名称位置类型必选说明
ApiKeyheaderstring在控制台的个人主页获取
bodybodyobjectnone
» app_idbodystring默认1001
» timestampbodystring时间戳
» nonce_strbodystring随机字符串
» databodyobjectnone
»» originbodystring文本内容或者文件ID
»» typebodystringtext-文本,file-文件
»» langbodystringcn-中文,en-英文
»» modebodystringnormal-普通,powerful-强力

返回示例

200 Response

{
  "code": 0,
  "message": "string",
  "data": {
    "taskId": "string"
  }
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenone0-成功,1-失败
» messagestringtruenone请求失败时此处可能会有消息提示
» dataobjecttruenonenone
»» taskIdstringtruenone任务id

openapi/v1/useRecord

POST 批量查询结果

POST /v1/use_record/batch_record

Body 请求参数

[
  0
]

请求参数

名称位置类型必选说明
ApiKeyheaderstring在控制台的个人主页获取
bodybodyarray[integer]none

返回示例

200 Response

{
  "code": 0,
  "message": "string",
  "data": [
    {
      "id": 0,
      "productId": 0,
      "cost": 0,
      "wordNum": 0,
      "title": "string",
      "author": "string",
      "origin": "string",
      "result": "string",
      "status": "string",
      "note": "string"
    }
  ]
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenone0-成功,1-失败
» messagestringtruenone请求失败时此处可能会有消息提示
» data[object]truenonenone
»» idintegertruenone任务id
»» productIdintegertruenone产品id
»» costnumbertruenone任务费用
»» wordNumintegertruenone字数
»» titlestringtruenone文章标题
»» authorstringtruenone文章作者
»» originstringtruenone原文的文件链接
»» resultstringtruenone处理结果的文件链接
»» statusstringtruenone任务状态(-1-失败,0-待处理,1-处理中,2-处理成功,3-处理失败),注意这是string不是integer
»» notestringtruenone备注信息

openapi/v1/user

GET 查询余额

GET /v1/user/balance

为了高可用性,提交任务时不会检查余额,所以批量提交任务并发写入数据库时可能导致余额变成负数,是正常现象

请求参数

名称位置类型必选说明
ApiKeyheaderstring在控制台的个人主页获取

返回示例

200 Response

{
  "code": 0,
  "message": "string",
  "data": 0
}

返回结果

状态码状态码含义说明数据模型
200OKnoneInline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenone0-成功,1-失败
» messagestringtruenone请求失败时此处可能会有消息提示
» datanumbertruenone账户余额

评论