API 参考

公开 API 基地址为 https://api.keykey.im。接口只读取已生成的记忆卡片和本地词典数据,不会触发 AI 生成。


GET/api/public/memory-card

查询单个词条

查询参数

  • Name
    word
    Type
    string
    Description

    查询文本,去除首尾空白后长度为 1-100 个字符。英语会规范化查询键,但响应可通过 displayWord 保留词典规定的大小写。

  • Name
    lang
    Type
    string
    Description

    语言代码,默认 en。查询页面内置 enesfrja

  • Name
    includeLocalDictionaryFallback
    Type
    boolean
    Description

    默认 false。设为 true1 后,如果完整记忆卡片不存在,接口会尝试返回本地词典中的基础词条。

响应头

  • Name
    X-RateLimit-Limit
    Type
    integer
    Description
    每日总配额。
  • Name
    X-RateLimit-Remaining
    Type
    integer
    Description
    当前剩余配额。
  • Name
    X-RateLimit-Reset
    Type
    string
    Description
    下一次重置时间,ISO 8601 格式。
  • Name
    Cache-Control
    Type
    string
    Description
    当前固定为 no-store

请求示例

curl -G https://api.keykey.im/api/public/memory-card \
  --data-urlencode 'word=hello' \
  -d lang=en \
  -d includeLocalDictionaryFallback=true

成功响应

200 OK(节选)

{
  "success": true,
  "data": {
    "word": "hello",
    "displayWord": "hello",
    "languageCategory": "en",
    "trans": ["interj.你好;喂;哈喽", "n.问候;招呼"],
    "practiceTrans": ["interj.你好;喂;哈喽", "n.问候;招呼"],
    "definitionRelease": 1,
    "phonetic": "/həˈloʊ/",
    "phoneticSystem": "IPA",
    "lexemeKey": "en:hello",
    "examples": [
      {
        "sentence": "Hello, how are you doing today?",
        "translation": "你好,你今天怎么样?",
        "usage": "日常问候,用于打招呼。"
      }
    ],
    "morphology": {
      "roots": [],
      "affixes": [],
      "analysis": "常见问候语。"
    },
    "englishDefinition": "used as a greeting or to begin a telephone conversation",
    "derivatives": [{ "word": "helloed", "definition": "v. 说你好" }],
    "dictionarySource": "ai-definition-rebuild:1",
    "dictionaryDetails": {
      "source": "ai-definition-rebuild:1",
      "sources": ["ai-definition-rebuild:1", "open-dictionary-v2.0"],
      "openDictionary": {
        "releaseTag": "v2.0",
        "schemaVersion": "distribution_entry_v5",
        "entryType": "standard",
        "headwordSummary": "词条概览",
        "memoryHook": "记忆线索",
        "studyNotes": ["学习提示"],
        "forms": [],
        "pronunciations": [],
        "etymologies": [],
        "relations": [],
        "meanings": []
      }
    },
    "tags": ["专八"],
    "cached": true
  },
  "rateLimit": {
    "remaining": 149,
    "limit": 150,
    "reset": "2026-08-25T00:00:00.000Z"
  }
}

POST/api/public/memory-card/batch-query

批量查询

一次最多查询 50 个词条。返回结果顺序与请求中的 words 一致,适合词表预取和批量导入前检查。

  • Name
    words
    Type
    string[]
    Description

    非空数组,最多 50 项;每项去除首尾空白后长度不超过 100 个字符。

  • Name
    languageCategory
    Type
    string
    Description

    语言代码,默认 en

  • Name
    includeLocalDictionaryFallback
    Type
    boolean
    Description

    是否允许本地词典兜底,默认 false

  • Name
    definitionMode
    Type
    string
    Description

    fullpractice,默认 fullpractice 会优先把精简练习释义放入 trans

每个需要查询数据库的词条消耗一个配额单位;命中本地词典兜底的词条不计入批量接口的计费词数。

cURL

curl -X POST https://api.keykey.im/api/public/memory-card/batch-query \
  -H 'Content-Type: application/json' \
  -d '{
    "words": ["hello", "world", "study"],
    "languageCategory": "en",
    "includeLocalDictionaryFallback": true,
    "definitionMode": "practice"
  }'

响应结构

{
  "success": true,
  "data": {
    "results": [
      { "word": "hello", "found": true, "data": {} },
      { "word": "unknown", "found": false }
    ],
    "total": 2,
    "found": 1,
    "notFound": 1
  },
  "rateLimit": {
    "remaining": 148,
    "limit": 150,
    "reset": "2026-08-25T00:00:00.000Z"
  }
}

MemoryCardData 字段

基础与多语言词形

  • Name
    word
    Type
    string
    Description

    稳定词条身份。日语保存日文原词,不保存拉丁输入键。

  • Name
    displayWord
    Type
    string
    Description

    词典规定的展示词形,可用于保留 ChinaMay 等有语义的大小写。

  • Name
    languageCategory
    Type
    string
    Description

    语言代码。

  • Name
    phonetic
    Type
    string
    Description

    发音标注值。

  • Name
    phoneticSystem
    Type
    string
    Description

    发音系统,例如 IPAromaji

  • Name
    notation
    Type
    string
    Description

    展示用原词形或带注音写法。

  • Name
    kanaReading
    Type
    string
    Description

    日语假名读法。

  • Name
    practiceWord
    Type
    string
    Description

    键盘练习目标,不等同于标准音标。

  • Name
    practiceAliases
    Type
    string[]
    Description

    练习判定允许的等价输入。

  • Name
    lexemeKey
    Type
    string
    Description

    稳定词条键;日语通常同时包含原词与读法。

日语响应示例:

{
  "word": "日本",
  "languageCategory": "ja",
  "phonetic": "nippon",
  "phoneticSystem": "romaji",
  "notation": "日本(にっぽん)",
  "kanaReading": "にっぽん",
  "practiceWord": "nippon",
  "practiceAliases": ["nippon"],
  "lexemeKey": "ja:日本:にっぽん"
}

释义与学习内容

  • Name
    trans
    Type
    string[]
    Description

    完整词典释义。

  • Name
    practiceTrans
    Type
    string[]
    Description

    用于记忆卡片和生词本的精简释义。

  • Name
    definitionRelease
    Type
    integer
    Description

    practiceTrans 对应的系统词典发布版本。

  • Name
    examples
    Type
    Example[]
    Description

    例句,包含 sentencetranslation 和可选的 usage

  • Name
    phrases
    Type
    Phrase[]
    Description

    词组搭配,包含 phrasetranslation 和可选的 usage

  • Name
    mnemonics
    Type
    string
    Description

    助记技巧。

  • Name
    etymology
    Type
    string
    Description

    历史词源说明。

  • Name
    morphology
    Type
    Morphology
    Description

    结构化词根、前后缀和构词分析。

  • Name
    englishDefinition
    Type
    string
    Description

    英文释义。

  • Name
    derivatives
    Type
    Derivative[]
    Description

    派生词、词性、释义和构词关系。

  • Name
    synonyms
    Type
    Synonym[]
    Description

    同义词辨析。

  • Name
    usageScenes
    Type
    string[]
    Description

    常见使用场景。

  • Name
    tags
    Type
    string[]
    Description

    考试、词库等标签。

词典增强信息

  • Name
    dictionarySource
    Type
    string
    Description

    主词典来源标识。

  • Name
    dictionaryDetails.source
    Type
    string
    Description

    增强数据的主要来源。

  • Name
    dictionaryDetails.sources
    Type
    string[]
    Description

    合并后的全部数据来源。

  • Name
    dictionaryDetails.openDictionary
    Type
    object
    Description

    Open Dictionary 结构化内容:词条摘要、记忆线索、学习提示、词形、发音、词源、同反义关系和分义详解。

  • Name
    dictionaryDetails.ielts
    Type
    object
    Description

    IELTS 出现次数、频率组、热力图和真题例句。

  • Name
    cached
    Type
    boolean
    Description

    是否来自已缓存的完整记忆卡片。

  • Name
    cardId
    Type
    string
    Description

    卡片 ID;部分调用场景会返回。


支持的语言

当前演示站查词入口支持以下语言:

  • Name
    en
    Description
    英语
  • Name
    es
    Description
    西班牙语
  • Name
    fr
    Description
    法语
  • Name
    ja
    Description
    日语,支持日文、假名和罗马输入匹配。

其他语言代码仍可查询数据库中已经存在的记忆卡片,但不保证具有本地词典兜底数据。


错误响应

  • Name
    INVALID_PARAMETER
    Type
    400
    Description

    参数为空、数组超过 50 项或单词超过 100 个字符。

  • Name
    NOT_FOUND
    Type
    404
    Description

    单词没有完整卡片,且未启用或未命中本地词典兜底。

  • Name
    RATE_LIMIT_EXCEEDED
    Type
    429
    Description

    每日配额已经用尽。

  • Name
    INSUFFICIENT_QUOTA
    Type
    429
    Description

    批量查询所需配额大于当前剩余配额。

  • Name
    INTERNAL_ERROR
    Type
    500
    Description

    服务器内部错误。

错误响应示例

{
  "success": false,
  "error": "该单词暂未生成记忆卡片",
  "code": "NOT_FOUND",
  "message": "单词 \"example\" (en) 尚未生成记忆卡片。",
  "rateLimit": {
    "remaining": 147,
    "limit": 150,
    "reset": "2026-08-25T00:00:00.000Z"
  }
}

Was this page helpful?