通过题目内容获取答案及解析。支持选择题、填空题、简答题等多种题型。
| 请求URL | POST /api/search 或 GET /api/search |
| 请求方法 | POST / GET |
| 认证方式 | API Key(请求头:X-API-Key) |
| 参数名 | 必填 | 类型 | 说明 |
|---|---|---|---|
title |
是 | string | 题目内容 |
options |
否 | string | 题目选项(选择题必填),每个选项占一行,例如:A. 选项1\nB. 选项2 |
type |
否 | string | 题目类型,可选值:single(单选题)、multiple(多选题)、judgement(判断题)、fill(填空题)、short_answer(简答题)、calculation(计算题)、essay(论述题)、coding(编程题)、reading_comprehension(阅读理解)、material_analysis(材料分析题)、cloze_test(完形填空)、translation(翻译题)、writing(写作题)、listening_comprehension(听力理解)、grammar(语法题)、vocabulary(词汇题)、paragraph_ordering(段落排序题)、error_correction(改错题)、summary_writing(概要写作)、continuation_writing(读后续写) |
POST 请求(JSON):
{
"title": "已知函数f(x)=x^2+2x+1,求f(x)的最小值。",
"type": "short_answer"
}
POST 请求(带选项):
{
"title": "下列哪个数是质数?",
"options": "A. 4\nB. 5\nC. 6\nD. 8",
"type": "single"
}
GET 请求:
GET /api/search?title=已知函数f(x)=x^2+2x+1,求f(x)的最小值。&type=short_answer
| 参数名 | 类型 | 说明 |
|---|---|---|
code |
integer | 状态码,1 表示成功,0 表示失败 |
question |
string | 题目内容(成功时返回) |
answer |
string | 题目答案(成功时返回) |
model |
string | 使用的AI模型名称(成功时返回) |
using_backup |
boolean | 是否使用了备用模型(可选,成功时可能返回) |
msg |
string | 错误信息(失败时返回) |
成功响应(选择题):
{
"code": 1,
"question": "下列哪个数是质数?",
"answer": "B",
"model": "deepseek-chat"
}
成功响应(简答题,使用备用模型):
{
"code": 1,
"question": "已知函数f(x)=x^2+2x+1,求f(x)的最小值。",
"answer": "0",
"model": "maas",
"using_backup": true
}
失败响应:
{
"code": 0,
"msg": "没有提供题目内容"
}
| 错误码 | 说明 |
|---|---|
400 |
请求参数错误(如缺少必填参数 title) |
401 |
未提供API密钥或密钥无效 |
429 |
请求过于频繁,触发限流 |
500 |
服务器内部错误(AI模型调用失败等) |
options 参数,答案将返回选项字母(如 A、B、C)正确 或 错误using_backup: true